[R] Reshape by multiple variables
Laura Gross
laura at bayesian-bay.freeserve.co.uk
Tue Nov 26 18:42:14 CET 2002
Dear list
I'm using the reshape command and want to reshape a wide data set to a
long one
e.g. I have the variables y1,y2,y3,age1,age2,age3,sex,ethnic
I want my new long data set to consist of the variables y (which has
been created from y1,y2,y3), age (which has been created from
age1,age2,age3), sex and ethnic
I have tried to use the command:
data1<-reshape(data,varying=list(c("y1","y2","y3"),c("age1","age2","age"
)),v.names="y","age", times=1:3,direction="long")
but it tells me I am trying to duplicate row names?
How can I put multiple time-varying variables into the varying bit?
Thanks for any help
Laura
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list