[R] Tabulation of aggregated data.frame
Oh Dong-hyun
r.arecibo at gmail.com
Fri May 9 18:25:03 CEST 2008
Hi useRs!
I would like to know how to make aggregated data.frame with
aggregate() tabulated.
For example, I run the following command to aggregate re with respect
to group1 and group2.
> (aggr <- with(final, aggregate(re, group1, group2, mean)))
Group.1 Group.2 x
1 1992 15 0.16392
2 1993 15 0.15467
3 1994 15 0.15456
4 1995 15 0.15391
5 1996 15 0.16511
6 1997 15 0.17368
7 1998 15 0.17955
8 1999 15 0.19805
9 2000 15 0.20546
10 1992 16 0.16237
11 1993 16 0.18359
12 1994 16 0.13811
13 1995 16 0.13988
14 1996 16 0.15604
15 1997 16 0.16802
16 1998 16 0.16978
17 1999 16 0.18407
18 2000 16 0.18646
19 1992 17 0.24604
20 1993 17 0.25263
21 1994 17 0.21407
22 1995 17 0.26483
23 1996 17 0.26427
24 1997 17 0.26282
25 1998 17 0.31137
26 1999 17 0.26982
27 2000 17 0.22898
28 1992 18 0.29417
29 1993 18 0.36586
30 1994 18 0.25143
31 1995 18 0.25570
32 1996 18 0.24628
33 1997 18 0.24293
34 1998 18 0.24888
35 1999 18 0.19515
36 2000 18 0.18057
I want make aggr as follows with class of data.frame.
1992 1993 1994 1995 1996 1997 1998
1999 2000
15 0.16392 0.15467......
16 0.16237 0.18359.......
17 .....
18 ......
Thank you in advance.
More information about the R-help
mailing list