[R] append with write.table()

Thomas Lumley tlumley at u.washington.edu
Mon Apr 29 17:28:32 CEST 2002


On Mon, 29 Apr 2002, Ulrich Leopold wrote:

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

cbind() will add columns to an object.

Adding columns to a file requires reading the file in and writing it out
again (it has to, since the new data are mixed in with the old on the
disk).

If the whole file is too big to read in you could read in a few lines at a
time with connections, use cbind() to add the extra columns, and write
those lines out to a new file.

	-thomas

Thomas Lumley			Asst. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle

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