how to add to a file, rather than overwrite using write.csv

how to add to a file, rather than overwrite using write.csv

simple question – I am using the write.csv function in R:

write.csv(t(y), file = "test.csv")

Where y is a dataframe of a file in my directory

However, I have many files in my directory, and I want the output of each file to be written to “test.csv” by using a loop. However, just testing this out I notice that if I write to test.csv, and then repeat the command with another file, instead of adding it overwrites test.csv instead of adding to it.

so my question is how to I add to test.csv rather than overwrite it.

Thanks very much.

write.csv(t(y), file = "test.csv", append=TRUE)

should do it.

.
.
.
.