[R] reshape (a better way)

Jean Eid jeaneid at chass.utoronto.ca
Wed Jan 26 20:54:35 CET 2005


Hi,

I am using the NLSY79 data (longitudinal data from the Bureau of labour
stats in the US). The extractor exctracts this data in a "wide" format and
I need to reshape it into a long format.

What I am doing right now is to do it in chuncks for each and evry
variable that is varying and then I merge the data together. This is
taking a long time. my question is:

How do I specify that there are multiple variables that are varying in
reshape. Is there a way to do this?

The idea is to have something like varying1, varying2,etc,... and each are
assosiated with their own times1, times2.

something like
reshape(mydata, direction="long", varying1=varying1,varying2=varying2,
varying3=varying3, split=list(regexp="[a-z][0-9]", include=TRUE),
idvar="ID", times1=times1, times2=times2, times3=times3)



Jean




More information about the R-help mailing list