alapalak
alapalak

Reputation: 147

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?

Upvotes: 9

Views: 12347

Answers (1)

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

Upvotes: 11

Related Questions