Re: [R] reshape a data frame

From: Dimitris Rizopoulos <dimitris.rizopoulos_at_med.kuleuven.be>
Date: Tue 22 Aug 2006 - 01:05:03 EST

maybe something like the following:

mdf <- data.frame(COL1 = rnorm(20))
mdf
as.data.frame(matrix(mdf$COL1, ncol = 2, byrow = TRUE))

I hope it helps.

Best,
Dimitris



Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium

Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
     http://www.student.kuleuven.be/~m0390867/dimitris.htm


> Dear R-helpers,
>
> I am trying to reshape a data frame which consists of only one
> column and of
> several thousand rows. My purpose is to select every second element
> (row) of
> the data frame and to create a second column with these elements.
>
> The data frame looks like this:
>
> COL1
> 23.190779669
> 74.659456135
> 74.019522268
> 27.099553199
> 50.02049443
> 76.518205961
> 75.924447203
> 75.774890661
> ...
>
> Could anybody give me a piece of advice how to proceed? Are there
> any
> commands to solve this problem?
>
> ______________________________________________
> R-help@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.
>

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm



R-help@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. Received on Tue Aug 22 01:13:14 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 22 Aug 2006 - 02:22:30 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.