[R] Export data frame of high dimension to txt
Allan Engelhardt
allane at cybaea.com
Thu Jul 1 11:29:50 CEST 2010
On 01/07/10 08:50, Loukia Spin. wrote:
> I managed with success to export a data frame of 367 columns and 37 rows to a txt file, but unfortunately I couldn't manage the same with the transposed data frame. Specifically, it seems like the notebook cannot "read" correctly 367 columns, so it reads the first 145 columns and it folds down the rest of them and consequently it folds down the respective data.
>
> f=format.data.frame(rev,trim=F,digits=NULL,nsmall=3, ## rev is the data frame of 37 rows and 367 columns ##
> justify="centre",zero.print=F,drop0trailing=T);f
>
I am not sure why you want to call format.data.frame first? A simple
write.table(rev, ...) should work fine. As it stands, write.table will
convert f back to a data.frame before writing
> write.table(f,file="C:/Program Files/R/R-2.11.0/genes as rows.txt",
> row.names=T,sep="\t",quote=F,dec=".",col.names=NA,append=T)
>
Careful with that append=TRUE. Try it with FALSE (the default) to make
sure the file really is empty. It might simply be text at the beginning
that trips up the subsequent read.table (which I am guessing from your
description is where the problem occurs).
Hope this helps a little.
Allan
More information about the R-help
mailing list