[R]selectively aggregate data

alexander.schnee@tuebingen.mpg.de alexander.schnee at tuebingen.mpg.de
Tue Jul 16 15:58:17 CEST 2002


sorry for sending this twice but i forgot the [R] in the subject

I'm shure that this kind of question is asked not for the fist time, but
i would be glad if someone of you could help me out
I have a data.frame like this :
     subjnr group block     data
1       33     1     1  564.476
2       33     1     1  289.185
3       33     1     1  483.372
4       33     1     1 1461.260
5       33     1     1  315.353
6       33     1     1  351.870
7       33     1     1 1238.350
8       33     1     1  218.135
9       33     1     1  335.486
10      33     1     1  312.848
11      33     1     1  224.989
12      33     1     1  383.283
13      33     1     1  317.788
14      33     1     1  310.263
15      33     1     1  216.295
16      33     1     1  309.118
17      33     1     1  216.223
33      35     1     1 1234.130
34      35     1     1  318.243
35      35     1     1  316.154
36      35     1     1 1478.610
37      35     1     1  528.299
38      35     1     1  253.566
39      35     1     1 1621.200
40      35     1     1  711.374
41      35     1     1  454.701
42      35     1     1  311.847
43      35     1     1  734.801
44      35     1     1  938.706
45      35     1     1  432.131
46      35     1     1 1498.540
47      35     1     1  330.199
48      35     1     1  694.136
49      35     1     1  321.608
65      37     1     1 1284.240
.........
and i like to have a data.frame with the values of the first 3 colloumns
preserved and in  colloumn 4 the mean  of each subjnr. it should look
like this :
     subjnr group block     data
1       33     1     1  444.017
2       35     1     1  716.367
3       37     1     1  428.507

I'm trying aggregate but i did not get the Parameters to fill in
thanks a lot if you can help me




-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list