Re: [R] Reconfiguring wide frame to long frame

From: Jesse Albert Canchola <jesse.canchola.b_at_bayer.com>
Date: Wed 19 Jul 2006 - 04:01:08 EST


Many thanks, Gabor. That worked great! I'm ecstatic.

Best regards,
Jesse

"Gabor Grothendieck" <ggrothendieck@gmail.com> 07/18/2006 10:12 AM

To
"Jesse Albert Canchola" <jesse.canchola.b@bayer.com> cc
r-help@stat.math.ethz.ch
Subject
Re: [R] Reconfiguring wide frame to long frame

Try this:

# set up test data
Lines <- "ID meas ID.1 meas.1

1   1.1        3      1.2
2   2.1        4      2.2

"
DF <- read.table(textConnection(Lines), header = TRUE)

# reshape
matrix(t(DF), nc = 2, byrow = TRUE, dimnames = list(NULL, colnames(DF)[1:2]))

On 7/18/06, Jesse Albert Canchola <jesse.canchola.b@bayer.com> wrote:
> Greetings, fellow R'ers.
>
> How can I get this frame in R:
>
> ID meas ID.1 meas.1
> 1 1.1 3 1.2
> 2 2.1 4 2.2
>
> to look like this (stacking):
>
> ID meas
> 1 1.1
> 2 2.1
> 3 1.2
> 4 2.2
>
> It's not really the reshape function (or is it?) because we can consider
> the additional columns, viz., ID.1 and meas.1, as independent of ID and

> meas so it is basically a stacking problem (no longitudinal component).
I
> can't seem to find a good example to do this in the docs. Thanks for
your
> help.
>
> Regards,
> Jesse
>
>
>
>
>
>
>
>
> Jesse A. Canchola
> Biostatistician III
> Bayer Healthcare
> 725 Potter St.
> Berkeley, CA 94710
> P: 510.705.5855
> F: 510.705.5718
> E: Jesse.Canchola.b@Bayer.Com
>
>
>
>
>
>



>
> The information contained in this e-mail is for the exclusive use of the
intended recipient(s) and may be confidential, proprietary, and/or legally privileged. Inadvertent disclosure of this message does not constitute a waiver of any privilege. If you receive this message in error, please do not directly or indirectly use, print, copy, forward, or disclose any part of this message. Please also delete this e-mail and all copies and notify the sender. Thank you.
>
> For alternate languages please go to http://bayerdisclaimer.bayerweb.com
>


>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>


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 Wed Jul 19 04:07:48 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 Wed 19 Jul 2006 - 06:21:28 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.