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

From: Peter Ehlers <>
Date: Tue, 01 Jun 2010 04:26:19 -0600

On 2010-05-31 18:33, Steven Worthington 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)
> # --------------------------------

It's always a good idea to check the NEWS file. Here is a quote:

   "write.csv[2] no longer allow 'append' to be changed: as ever,     direct calls to write.table() give more flexibility as well as     more room for error."

So use write.table.

   -Peter Ehlers mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Tue 01 Jun 2010 - 10:30:53 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 01 Jun 2010 - 10:50:25 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive