[R] Error using reshape method
shmy
shmy.shmy at yahoo.com
Tue Apr 13 03:21:18 CEST 2010
To be fair I don't really understand what the error is telling me so I don't
know how to correct it.
I'm trying to reshape my data so that I do repeated measures ANOVA on it.
The warning message: "Error in d[, timevar] <- times[1L] : subscript out of
bounds"
The program:
library(QRMlib)
library(Hmisc)
ss<-5
mu<- c(0,2,3,12)
mu2<- c(0,2,10,20)
dims<- 4
co<- c(.3,.4,.5,.4,.3,.2)
replis<- 3
stdev<-c(1,2,5,10)
#1st set
corrmat <- matrix(1, dims, dims)
corrmat[upper.tri(corrmat)]<-co
selectlow <- lower.tri(corrmat)
corrmat[selectlow] <- t(corrmat)[selectlow]
sigma<- diag(stdev) %*% corrmat %*% diag(stdev)
simu1<-rmnorm(n=ss, Sigma=sigma, mu=mu, d=dims, rho=co)
simu11<-cbind(simu1,data.grp=1)
#2nd set
corrmat2 <- matrix(1, dims, dims)
corrmat2[upper.tri(corrmat2)]<-co
selectlow2 <- lower.tri(corrmat2)
corrmat2[selectlow2] <- t(corrmat2)[selectlow2]
sigma2<- diag(stdev) %*% corrmat2 %*% diag(stdev)
simu2<-rmnorm(n=ss, Sigma=sigma2, mu=mu2, d=dims, rho=co)
simu22<-cbind( simu2,data.grp=2)
data.all<-rbind(simu11,simu22)
new.data.all<-rbind(data.all)
data.all<-rbind(data.all)
data.frame(data.all)
Y<-cbind(data.all[,1], data.all[,2], data.all[,3], data.all[,4])
rmlong.data<-reshape(data.all, varying=list(names(data.all)),
direction="long" ) # Part that's giving me trouble.
Thank you for your help!
--
View this message in context: http://n4.nabble.com/Error-using-reshape-method-tp1837911p1837911.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list