Hello, I've a data frame with 15 colums and 6000 rows, and I need the data in a single vector of size 90000 for ttest. Is there such a conversion function in R, or would I have to write my own loop over the colums? thanks for your help + kind regards Arne
Use unlist. In any case, don't write an explicit "loop over the columns". See ?lapply instead.> -----Original Message----- > From: Arne.Muller at aventis.com [mailto:Arne.Muller at aventis.com] > Sent: 05 September 2003 16:08 > To: r-help at stat.math.ethz.ch > Subject: [R] all values from a data frame > > > Security Warning: > If you are not sure an attachment is safe to open please contact > Andy on x234. There are 0 attachments with this message. > ________________________________________________________________ > > Hello, > > I've a data frame with 15 colums and 6000 rows, and I need > the data in a > single vector of size 90000 for ttest. Is there such a conversion > function in > R, or would I have to write my own loop over the colums? > > thanks for your help + kind regards > > Arne > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help >Simon Fear Senior Statistician Syne qua non Ltd Tel: +44 (0) 1379 644449 Fax: +44 (0) 1379 644445 email: Simon.Fear at synequanon.com web: http://www.synequanon.com Number of attachments included with this message: 0 This message (and any associated files) is confidential and\...{{dropped}}
If I understand you correctly, you want to stack the 15 columns on top of one another? I assuming all the data is numeric? In this case, convert the data.frame to a matrix and set the dim of the matrix to NULL. If df is the data.frame, df1 <- as.matrix(df) dim(df1) <- NULL <Arne.Muller at aventis.com> Sent by: r-help-bounces at stat.math.ethz.ch 09/05/2003 11:07 AM To: <r-help at stat.math.ethz.ch> cc: Subject: [R] all values from a data frame Hello, I've a data frame with 15 colums and 6000 rows, and I need the data in a single vector of size 90000 for ttest. Is there such a conversion function in R, or would I have to write my own loop over the colums? thanks for your help + kind regards Arne ______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
Dear Arne, At 05:07 PM 9/5/2003 +0200, Arne.Muller at aventis.com wrote:>Hello, > >I've a data frame with 15 colums and 6000 rows, and I need the data in a >single vector of size 90000 for ttest. Is there such a conversion function in >R, or would I have to write my own loop over the colums? > > thanks for your help + kind regardsunlist() should do what you want. I hope that this helps, John ----------------------------------------------------- John Fox Department of Sociology McMaster University Hamilton, Ontario, Canada L8S 4M4 email: jfox at mcmaster.ca phone: 905-525-9140x23604 web: www.socsci.mcmaster.ca/jfox