[R] append with write.table()

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Mon Apr 29 12:30:45 CEST 2002


On Mon, 29 Apr 2002, Ulrich Leopold wrote:

> I get the following message while trying to append an object to a file.

You are writing a data frame to a file. You have asked that the column
names be written out.  That makes little sense in the middle of the file,
so you get a warning.  Appending is (more-or-less) only useful to add rows
to an existing data frame on a file.

> In addition it is not appended. Do you know why?

No, but then you haven't given us anything much to go on.
Here's a working example:

> library(MASS)
> data(hills)
> write.table(hills[1:20,], "hills.dat", quote=FALSE, sep="\t")
> write.table(hills[22:25,], "hills.dat", quote=FALSE, sep="\t",
              append=TRUE, col.names=FALSE)


>  > write.table(PoxAv, "/home/uleopold/lsk_PoxAv", append=TRUE ,
> quote=FALSE, sep="\t")
> Warning message:
> appending column names to file in: write.table(PoxAv,
> "/home/uleopold/lsk_PoxAv", append = TRUE,
>
> Ulrich Leopold MSc.


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list