简体   繁体   English

write.table 额外列

[英]write.table extra column

In the following data.frame there are 6 columns, but 7 are written to the CSV file.在下面的 data.frame 中有 6 列,但有 7 列写入 CSV 文件。 Can't figure out why.想不通为什么。

install.packages("pmlr")
library(pmlr)
data(enzymes)
write.table(enzymes, sep=",", eol="\n",file="albert.csv")

This question is better suited to StackOverflow.这个问题更适合 StackOverflow。 In any case, the problem is that R by default writes the row names.无论如何,问题在于 R 默认写入行名。 To write only the data itself, use要仅写入数据本身,请使用

 write.table(enzymes, sep=",", eol="\n", file="albert.csv", row.names=FALSE)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM