Re: [R] reversed variables in stats::reshape()

2014-01-30 Thread Doug Morrison
Thanks Arun! I see now that the description of the "varying" argument for reshape includes the following: "This is canonically a list of vectors of variable names" Originally, I saw in the Details section: "Notice that the order of variables in varying is like x.1,y.1,x.2,y.2." Best, Doug On

Re: [R] reversed variables in stats::reshape()

2014-01-24 Thread arun
Another way would be to change the colnames() colnames(data1)[grep("min",colnames(data1))] <- gsub("(\\d+)\\D+(\\w+)$","\\2_\\1",colnames(data1)[grep("min",colnames(data1))]) varying1 <- colnames(data1)[3:32] test2 <- reshape(     data = data1,     direction = "long",     idvar = c(

Re: [R] reversed variables in stats::reshape()

2014-01-24 Thread arun
Hi, You can change varying1 to: varying1 = list(seq(3,ncol(data1),2), seq(4,ncol(data1),2))#and then try it on your code test = reshape(     data = data1,     direction = "long",     idvar = c("Participant","Treatment"),     v.names = c("R","L"),     times= seq(2, 30, by = 2),   

[R] reversed variables in stats::reshape()

2014-01-24 Thread Doug Morrison
Dear R-Help readers, I am writing to ask about some behavior by stats::reshape() that surprised me. In the example below, I expected the values of variables "R" and "L" in data.frame "test" to be the reverse of what they are - ie I expected that test$R = seq(1:29, by =2) and test$L = seq(2:30, by