Re: [R] write to file append by column

2009-11-24 Thread jim holtman
Here is the way to get the required output: > x <- data.frame(a=1:3) > write.csv(x, file='tempxx.csv', row.names=FALSE) > # new data > newData <- data.frame(b=4:6) > # read old data back in > oldData <- read.csv('tempxx.csv') > # cbind the new data > write.csv(cbind(oldData, newData), file='tempxx

Re: [R] write to file append by column

2009-11-24 Thread e-letter
On 24/11/2009, jim holtman wrote: > 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 wrote: >> Readers, >> >> Scenario: data x consists of one column; >> 1 >> 2 >> 3 >> >> data y; >> 4 >> 5 >> 6

Re: [R] write to file append by column

2009-11-24 Thread jim holtman
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 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 fil

[R] write to file append by column

2009-11-24 Thread e-letter
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=TR