Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using R to append a row to a .csv file

I have a .csv file with 175 rows and 6 columns. I want to append a 176th row. 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?

like image 961
alapalak Avatar asked May 04 '17 17:05

alapalak


1 Answers

write.table(x, file = "Tweets.csv", sep = ",", append = TRUE, quote = FALSE,
  col.names = FALSE, row.names = FALSE)
like image 123
Kristoffer Winther Balling Avatar answered Sep 30 '22 23:09

Kristoffer Winther Balling