[R] reshape with two time variables

Neil Stewart neil.stewart at warwick.ac.uk
Sat Jan 31 16:51:54 CET 2009


Thank you all so much for your help.

I've gone with

repeated_measures_data.csv:
sub,A1B1,A1B2,A2B1,A2B2
s1,400,475,420,510
s2,390,500,470,472
s3,428,512,555,610
s4,703,787,801,822
s5,611,634,721,705
s6,543,522,612,788
s7,411,488,506,623
s8,654,644,711,795

library(reshape)
data<-read.csv("repeated_measures_data.csv")
data.long <- melt(data)
data.long$A <- as.factor(substr(data.long$variable,1,2))
data.long$B <- as.factor(substr(data.long$variable,3,4))
data.long$variable <- NULL
data.long <- rename(data.long, c("value"="RT"))

as it offers the smallest chance of me messing up the factor levels.




More information about the R-help mailing list