[R] How to 'de-cross' a table?
Charles Plessy
charles-r-nospam at plessy.org
Fri Jun 3 17:31:23 CEST 2005
On Fri, Jun 03, 2005 at 04:33:44PM +0200, Sander Oom wrote :
> 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
I think that "reshape" is the tool you are looking for.
--
Charles
More information about the R-help
mailing list