[R] How to 'de-cross' a table?

Sander Oom slist at oomvanlieshout.net
Fri Jun 3 16:33:44 CEST 2005


Dear R users,

I have received a table in the following format:

id  a   b  c1  c2  d1  d2
1   1   1  65  97  78  98
2   1   2  65  97  42  97
3   2   1  65  68  97  98
4   2   2  65  97  97  98

Factors of the design are: a, b, and e, where e has levels c and d. The
levels c and d then have 2 replicates (r) each.

Now I would like to get:

id  a   b   e   r  value
1   1   1   c   1  65
2   1   1   c   2  97
3   1   1   d   1  78
4   1   1   d   2  98

Any suggestions on how to tackle this? I'm not sure what the 'task' is
called, so struggle to effectively search the web or R help.

Thanks,

Sander.


--------------------------------------------
Dr Sander P. Oom
Animal, Plant and Environmental Sciences,
University of the Witwatersrand
Private Bag 3, Wits 2050, South Africa
Tel (work)      +27 (0)11 717 64 04
Tel (home)      +27 (0)18 297 44 51
Fax             +27 (0)18 299 24 64
Email   sander at oomvanlieshout.net
Web     www.oomvanlieshout.net/sander




More information about the R-help mailing list