[R] write to file append by column

jim holtman jholtman at gmail.com
Tue Nov 24 13:44:03 CET 2009


You can not append a column.  Best bet, read the old file in, do a
'cbind', write the object back out.

On Tue, Nov 24, 2009 at 5:59 AM, e-letter <inpost at gmail.com> wrote:
> Readers,
>
> Scenario: data x consists of one column;
> 1
> 2
> 3
>
> data y;
> 4
> 5
> 6
>
> Is it possible to write to file such that the file is:
> 1,4
> 2,5
> 3,6
>
> using the write.file function? I have tried the command:
>
> write(x,file="file.csv",ncolumns=1,append=TRUE,sep=",")
> write(y,file="file.csv",ncolumns=1,append=TRUE,sep=",")
>
> but the result is:
>
> 1
> 2
> 3
> 4
> 5
> 6
>
> yours,
>
> rhelpatconference.jabber.org
> r 251
> mandriva 2008
>
> ______________________________________________
> 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?




More information about the R-help mailing list