Dear K:
Here is another example:
> x.df
y x1 x2
1 1 -1.02 0.70
2 1 0.73 0.26
3 1 -0.11 1.17
4 1 -1.59 0.05
5 1 0.78 1.32
6 1 0.25 0.18
7 1 0.26 1.43
8 1 -0.64 0.02
9 1 1.05 1.79
10 1 2.16 2.10
11 2 -0.53 0.01
12 2 -1.53 0.37
13 2 -0.28 0.86
14 2 -0.39 0.78
15 2 -0.02 0.02
16 2 0.86 1.73
17 2 -1.06 0.06
18 3 -0.48 0.96
19 3 -1.02 0.61
20 3 1.24 0.06
> aggregate(x.df[,2:3],list(fact=x.df[,1]),mean)
fact x1 x2
1 1 0.18700000 0.9020000
2 2 -0.42142857 0.5471429
3 3 -0.08666667 0.5433333
>
Hope this helps!
Sincerely,
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: hodgess@gator.uhd.edu
|