[R] How to re-arrange data in table?
Rene Braeckman
RMan54 at cox.net
Thu Feb 15 21:34:54 CET 2007
Thanks for the reply. I applied your suggestions on my example and maybe I
am missing something but these are alternate ways to create the original
table but not the re-arranged table. The data are not stacked by Analyte. I
will take a look at the documentation for this library to check whether
other code can do it.
Rene
-----Original Message-----
From: hadley wickham [mailto:h.wickham at gmail.com]
Sent: Thursday, February 15, 2007 11:56 AM
To: Rene Braeckman
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] How to re-arrange data in table?
> I like to re-arrange a table (sTable) based on the value of one the
> rows
> (Analyte) as shown below. Blocks of data with different values for
> Analyte need to be stacked below each other. Any easy way to do this
> or any advice where to look?
How about:
library(reshape)
dfm <- melt(df, m="AUC")
cast(dfm, Analyte + result_variable ~ Dose, myStats)
# A few other variations
cast(dfm, Analyte ~ Dose ~ result_variable, myStats) cast(dfm, Analyte +
Dose ~ result_variable, myStats)
# See http://had.co.nz/reshape for more documentation
Hadley
More information about the R-help
mailing list