I have a dataset in wide form with more than 1500 columns. Since many of the variables are repeated I´d like to reshape into long form. However, r throws an error:
Error in guess(varying) :
Failed to guess time-varying variables from their names
Trying to understand this with a toy example I find that
u<-data.frame(id=1:100,f.1=rnorm(100),u.1=rnorm(100),i.1=rnorm(100),f.2=rnorm(100),u.2=rnorm(100),i.2=rnorm(100),
f.3=rnorm(100),u.3=rnorm(100),i.3=rnorm(100))
reshape(u,varying=2:10,direction="long")
works fine. However, my data looks more like :
u<-data.frame(id=1:100,f1=rnorm(100),u1=rnorm(100),i1=rnorm(100),f2=rnorm(100),u2=rnorm(100),i2=rnorm(100),
f3=rnorm(100),u3=rnorm(100),i3=rnorm(100))
reshape(u,varying=2:10,direction="long")
and this is where I´m lost. Any smart idea, except of changing the variable names (which is tiring), of how I can do this?