简体   繁体   中英

write.table extra column

In the following data.frame there are 6 columns, but 7 are written to the CSV file. 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. In any case, the problem is that R by default writes the row names. To write only the data itself, use

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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