0
df = readRDS('mydata.RDS')
message('column names: ',colnames(df))
輸出打印用空格
column names: col1col2col2col4
colnames我怎樣才能得到它用空格打印像
column names: col1 col2 col3 col4
df = readRDS('mydata.RDS')
message('column names: ',colnames(df))
輸出打印用空格
column names: col1col2col2col4
colnames我怎樣才能得到它用空格打印像
column names: col1 col2 col3 col4
您可以使用paste()
。我使用了mtcars
數據集並添加了換行符。
message(
"now have the following columns: ",
paste(colnames(mtcars), collapse = " "),
"\nand the following rows: ",
nrow(mtcars)
)
# now have the following columns: mpg cyl disp hp drat wt qsec vs am gear carb
# and the following rows: 32