-1

After executing write.csv the file connection is closed, because of which whenever I write data into the file, the old data is lost. But I want to keep writing data into the file without losing the old data. How do I do that? Thanks in advance.

epo3
  • 2,991
  • 2
  • 33
  • 60

1 Answers1

1

You need to change the argument append = TRUE.

Have a look at ?write.csv

EDIT:

As @r.bot suggested using write.table might be a better option that write.csv which might return an error. More info here.

epo3
  • 2,991
  • 2
  • 33
  • 60
  • 1
    I'm dont think that append works for csv files. I just tested it and got the message `attempt to set 'append' ignored`. It works for `write.table` though – r.bot May 24 '16 at 12:13
  • You're right. I'll edit my answer. – epo3 May 24 '16 at 12:15