Using R to append a row to a .csv file
10,883
write.table(x, file = "Tweets.csv", sep = ",", append = TRUE, quote = FALSE,
col.names = FALSE, row.names = FALSE)
Comments
-
alapalak almost 2 years
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?
-
Debjyoti over 3 yearshow can I append rows to the head of the csv file instead of attaching at the bottom?