Just learned another trick today. Thanks a lot to both of you for the kind
help!
Gang
On Sun, May 22, 2011 at 6:04 PM, Dennis Murphy wrote:
> Hi:
>
> library(reshape2)
> d1 <- melt(d, id = 'Subj')
> d1 <- cbind(d1, colsplit(d1$variable, '_', c('Time', 'Cond')))
> d1 <- transform(d1,
>
Hi:
library(reshape2)
d1 <- melt(d, id = 'Subj')
d1 <- cbind(d1, colsplit(d1$variable, '_', c('Time', 'Cond')))
d1 <- transform(d1,
Time = substr(Time, 2, 2),
Cond = substr(Cond, 5, 5))[c(1, 4, 5, 3)]
str(d1)
d1
You can decide whether to leave Time and Cond as char
On May 22, 2011, at 5:25 PM, Gang Chen wrote:
I know how to convert a simple dataframe from wide to long format
with one
varying factor. However, for a dataset with two factors like the
following,
Subj T1_Cond1 T1_Cond2 T2_Cond1 T2_Cond2
1 0.125869 4.108232 1.099392 5.556614
2 1.
I know how to convert a simple dataframe from wide to long format with one
varying factor. However, for a dataset with two factors like the following,
Subj T1_Cond1 T1_Cond2 T2_Cond1 T2_Cond2
1 0.125869 4.108232 1.099392 5.556614
2 1.427940 2.170026 0.120748 1.176353
How to eleg
4 matches
Mail list logo