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 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) Is there something wrong? Thank you in advance, Loukia Maria S. _________________________________________________________________ Hotmail: Áîéüðéóôï email ìå ôçí éó÷õñÞ ðñïóôáóßá åíÜíôéá óôçí áíåðéèýìçôç áëëçëïãñáößá ðïõ ðáñÝ÷åé ç Microsoft. [[alternative HTML version deleted]]
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
Loukia, Do you mean that the lines are wrapped when you open the file in Notepad? Notepad seems to wrap lines after 1024 characters. Try to open the file in a more decent editor, e.g. notepad++, gvim, ... and there are probably plenty more editors available. Hope this helps. Jan On Thu, Jul 1, 2010 at 9:50 AM, Loukia Spin. <loukiamar at hotmail.com> 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 > > 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) > > Is there something wrong? > > Thank you in advance, > Loukia Maria S. > > _________________________________________________________________ > Hotmail: ????????? email ?? ??? ?????? ????????? ??????? ???? ??????????? ???????????? ??? ??????? ? Microsoft. > > ? ? ? ?[[alternative HTML version deleted]] > > > ______________________________________________ > 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. > >