Possible Duplicate:
write.csv() a list of unequally sized data.frames
I have a data frame called patients3 with 100 rows and 129 columns, which I write out to a .csv file using write.csv.
My client would like several lines appended to the beginning of this file. The exact contents of some of the lines depend on variables in the same data, and some do not. Each row has a different number of columns. The first row is simple,
FILEFORMATID 1000
I tried this code
line1 <- data.frame(cbind("FILEFORMATID", "1000"))
######### OUTPUT MANAGEMENT 4: WRITING FILES
write.csv(line1, paste("c:/personal/consults/ElwinWu/output", filenum, ".csv"))
write.csv(patients3, paste("c:/personal/consults/ElwinWu/output", filenum, ".csv"), quote = FALSE, append = T)
but got a warning
Warning message: In write.csv(patients3, paste("c:/personal/consults/ElwinWu/output", : attempt to set 'append' ignored
and, indeed, the earlier file was overwritten.
Can this be done within R?
Thanks