Writing an array to CSV, unexpected behavior for col.names = F

I am trying to write an array in CSV without row and column names. Setting column names to false does not work. I get an "x" for the column name and warning.

Any ideas how to remove this "x"?

write.csv(1:5, row.names = F, col.names = F)

# "x"
# 1
# 2
# 3
# 4
# 5
# Warning message:
#   In write.csv(1:5, row.names = F, col.names = F) :
#   attempt to set 'col.names' ignored
+4
source share
1 answer

?write.csv indicates that among other things, for write.csv arguments:

append, col.names, sep, dec and qmethod cannot be changed

To get around this, use the more general version, write.table.

write.table(1:5, row.names = FALSE, col.names = FALSE, sep=',')
# 1
# 2
# 3
# 4
# 5
+6
source

Source: https://habr.com/ru/post/1658074/


All Articles