Hi, I am always with this qustion when I tried to write a data.frame with row.names and col.names. I have to re-make the data frame to let its first column be the rownames and let row.names=F so that I can align the colnames correctly. Is there a way or option in write.table to automatically do that? thanks. -- Weiwei Shi, Ph.D Research Scientist GeneGO, Inc. "Did you always know?" "No, I did not. But I believed..." ---Matrix III
write.table(mydata.frame, "mydata", col.names=NA, quote=F, sep="\t") will solve the problem. Deng -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of Weiwei Shi Sent: August 10, 2007 12:41 PM To: r-help at stat.math.ethz.ch Subject: [R] write.table Hi, I am always with this qustion when I tried to write a data.frame with row.names and col.names. I have to re-make the data frame to let its first column be the rownames and let row.names=F so that I can align the colnames correctly. Is there a way or option in write.table to automatically do that? thanks. -- Weiwei Shi, Ph.D Research Scientist GeneGO, Inc. "Did you always know?" "No, I did not. But I believed..." ---Matrix III ______________________________________________ R-help at stat.math.ethz.ch 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.
I did not read ?write.table in details about CSV section. Thanks. On 8/10/07, Yinghai Deng <Yinghai.Deng at bri.nrc.ca> wrote:> write.table(mydata.frame, "mydata", col.names=NA, quote=F, sep="\t") will > solve the problem. > Deng > -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of Weiwei Shi > Sent: August 10, 2007 12:41 PM > To: r-help at stat.math.ethz.ch > Subject: [R] write.table > > > Hi, > > I am always with this qustion when I tried to write a data.frame with > row.names and col.names. I have to re-make the data frame to let its > first column be the rownames and let row.names=F so that I can align > the colnames correctly. > > Is there a way or option in write.table to automatically do that? > > thanks. > > -- > Weiwei Shi, Ph.D > Research Scientist > GeneGO, Inc. > > "Did you always know?" > "No, I did not. But I believed..." > ---Matrix III > > ______________________________________________ > R-help at stat.math.ethz.ch 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. > >-- Weiwei Shi, Ph.D Research Scientist GeneGO, Inc. "Did you always know?" "No, I did not. But I believed..." ---Matrix III