[R] reshaping issue

Stijn Van Daele Stijn.VanDaele at UGent.be
Tue May 17 19:31:32 CEST 2011


Dear R users,

I have a problem with reshaping data. I know such questions have been asked before, but I can't get it right, neither with the reshape function nor with the melt function.

My dataset has about 407 variables and about 48000 cases.

Each case looks as follows:
V1     v2     v3    v4    v5    v6     v7    x1     y1     x2     y2 ....  x200     y200

V1 is unique, v2-v7 are settings (that are linked to V1) and x and y are measures

What I would like is for each V1 is a combination of its unique id, the settings that apply to that case and then the X and Y values (these are linked to each other, so belong in the same row). Something like this:
V1     v2     v3    v4    v5    v6     v7    x1     y1
V1     v2     v3    v4    v5    v6     v7    x2     y2 
...
V1     v2     v3    v4    v5    v6     v7    x200     y200 

I have difficulties with the fact that I have two varying variables (x and y) that should stay together.

Could anyone help this R-newbie out?

Thanks in advance,
Stijn


More information about the R-help mailing list