[R] New behavior of 'write.csv' append argument?

Ivan Calandra ivan.calandra at uni-hamburg.de
Tue Jun 1 12:09:04 CEST 2010

Is there a reason why append=TRUE should not be used?

I actually use it a lot; that way I have less csv files created. I can 
output everything to a single file. Since some statistical tests returns 
lists with different number of elements, it is not always possible to 
export the output all at once (or at least I don't know how).
All the packages that I know of that export to xls do not append either.

So from R2.11 is there no way to append to xls/csv anymore?


Le 6/1/2010 11:56, jim holtman a écrit :
> As noted in the help file under CSV files:
> These wrappers are deliberately inflexible: they are designed to
> ensure that the correct conventions are used to write a valid file.
> Attempts to change append, col.names, sep, dec or qmethod are ignored,
> with a warning.
> On Mon, May 31, 2010 at 8:33 PM, Steven Worthington
> <steven.worthington at gmail.com>  wrote:
>> Dear R users,
>> I have recently begun to reuse some functions I made several months ago. The
>> scripts write to a .csv file using the 'write.csv' function with the append
>> option set to TRUE. This used to work fine, albeit with the warning
>> "appending column names to file". I upgraded to R version 2.11.0 on OSX
>> 10.5.8 and 'write.csv' will no longer append any files - I get the warning
>> "attempt to set 'append' ignored". The exact same object will append when
>> using 'write.table' without issue. Here's a minimal example. Has there been
>> a change in 'write.csv'?
>> # --------------------------------
>> x<- rnorm(10, 5)
>> y<- rnorm(10, 10)
>> z<- rnorm(10, 15)
>> dat<- data.frame(x, y, z)
>> names(dat)<- c("first", "second", "third")
>> write.csv(dat, file="dat.csv", append=TRUE)
>> write.table(dat, file="dat2.csv", sep=",", row.names=FALSE, append=TRUE)
>> # --------------------------------
>> best,
>> Steve
>> --
>> View this message in context: http://r.789695.n4.nabble.com/New-behavior-of-write-csv-append-argument-tp2237936p2237936.html
>> Sent from the R help mailing list archive at Nabble.com.
>> ______________________________________________
>> R-help at 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.

PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calandra at uni-hamburg.de


More information about the R-help mailing list