简体   繁体   English

使用 R 将行追加到 .csv 文件

[英]Using R to append a row to a .csv file

I have a .csv file with 175 rows and 6 columns.我有一个包含 175 行和 6 列的 .csv 文件。 I want to append a 176th row.我想追加第 176 行。 My code is as follows:我的代码如下:

x <- data.frame('1', 'ab', 'username', '<some.sentence>', '2017-05-04T00:51:35Z', '24')

write.table(x, file = "Tweets.csv", append = T)

What I expect to see is: enter image description here我希望看到的是:在此处输入图像描述

Instead, my result is: enter image description here相反,我的结果是:在此处输入图像描述

How should I change my code?我应该如何更改我的代码?

write.table(x, file = "Tweets.csv", sep = ",", append = TRUE, quote = FALSE,
  col.names = FALSE, row.names = FALSE)

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

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