命令:
t <- data.frame(v = 5:1, v2 = 9:5)
write.csv(t, "t.csv")
结果文件:
# "","v","v2"
# "1",5,9
# "2",4,8
# "3",3,7
# "4",2,6
# "5",1,5
如何防止将具有行索引的第一列写入文件?
最佳答案
write.csv(t, "t.csv", row.names=FALSE)
来自?write.csv
:
row.names: either a logical value indicating whether the row names of
‘x’ are to be written along with ‘x’, or a character vector
of row names to be written.
关于r - 使用 write.csv 时防止将行名称写入文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7484325/