On Feb 8, 2012, at 21:56 , David Winsemius wrote: > > On Feb 8, 2012, at 2:29 PM, Ron Michael wrote: > >> Okay, so I understood that appending can only happen row-wise. Therefore I >> tried with following code: >> >>> write.csv(matrix(1:5, 1), "dat.csv") >>> write.csv(matrix(1:5, 1), "dat.csv", append = TRUE) >> Warning message: >> In write.csv(matrix(1:5, 1), "dat.csv", append = TRUE) : >> attempt to set 'append' ignored >> >> It is destroying my previous file. Where I have done wrong? > > Failed to read the help page. `write.csv` has some of its setting hard coded > and will prevent you from changing them.
Exactly. Note, however, that write.csv is really just write.table with a particular set of arguments. Nothing is keeping you from using a similar set of arguments with append=TRUE in an explicit write.table() call. It is of course debatable whether the behavior of write.csv is undue patronizing, but as I understand it, the rationale is that you can guarantee that write.csv creates a proper CSV file, but once you start appending, multiple things can go wrong: Forgetting to omit headers, different number of columns, different column types, etc. It is not realistic to have write.csv(...append=TRUE) make the necessary checks, and as it can't be sure to write a properly formed CSV, it just won't do it, period. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd....@cbs.dk Priv: pda...@gmail.com ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.