[R] append with write.table()

Liaw, Andy andy_liaw at merck.com
Mon Apr 29 14:52:43 CEST 2002


If you are on an Unix or Linux system (or have the cygwin tools under
Windoze), you can write it to a separate file, then use 'paste' to join them
column-wise at the shell.

Andy

> -----Original Message-----
> From: Ulrich Leopold [mailto:uleopold at science.uva.nl]
> Sent: Monday, April 29, 2002 7:59 AM
> To: ripley at stats.ox.ac.uk
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] append with write.table()
> 
> 
> >>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.
> 
>  
> Thanks Brian for pointing out.I think was wrong in what I 
> wanted to do.
> 
> I wanted to append columns not rows. I thought it is possible 
> with that command.
> 
> Is there a command which is similar to that but adding 
> columns to a file or an object?
> 
> Ulrich
> 
> 
> -- 
> __________________________________________________
> 
> Ulrich Leopold MSc.
> 
> Department of Physical Geography
> Institute for Biodiversity and Ecosystem Dynamics
> Faculty of Science
> University of Amsterdam
> Nieuwe Achtergracht 166
> NL-1018WV Amsterdam
> 
> Phone: +31-(0)20-525-7456 (7451 Secretary)
> Fax:   +31-(0)20-525-7431
> Email: uleopold at science.uva.nl
> http://www.frw.uva.nl/soil/Welcome.html
> 
> Check us also out at:
> Netherlands Centre for Geo-ecological Research
> http://www.frw.uva.nl/icg
> 
> 
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
> -.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
> _._._._._._._._._
> 


------------------------------------------------------------------------------
Notice:  This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message.  If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it.

==============================================================================

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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