?aggregate

> y
   year site rep      rain
1  1980    1   1 2.6550866
7  1980    1   2 3.7212390
13 1980    1   3 5.7285336
4  1980    2   1 9.0820779
10 1980    2   2 2.0168193
16 1980    2   3 8.9838968
2  1981    1   1 9.4467527
8  1981    1   2 6.6079779
14 1981    1   3 6.2911404
5  1981    2   1 0.6178627
11 1981    2   2 2.0597457
17 1981    2   3 1.7655675
3  1982    1   1 6.8702285
9  1982    1   2 3.8410372
15 1982    1   3 7.6984142
6  1982    2   1 4.9769924
12 1982    2   2 7.1761851
18 1982    2   3 9.9190609
> aggregate(y, list(y$year, y$site), mean)
  Group.1 Group.2 year site rep     rain
1    1980       1 1980    1   2 4.034953
2    1981       1 1981    1   2 7.448624
3    1982       1 1982    1   2 6.136560
4    1980       2 1980    2   2 6.694265
5    1981       2 1981    2   2 1.481059
6    1982       2 1982    2   2 7.357413
>



On 5/30/06, Milton Cezar <miltinho_astronauta@yahoo.com.br> wrote:
>
> Hi there,
> I´m a newbie in R and I´m looking for some advice how to teste Piecewise
> (Broken Stick) models.
>
> I´have another simple question: how can I compute descriptive statistics
> for data grouped for two or more variables? See below, please.
>
> Year  Site Repetition rainfall
>   1980  1         1         ...
>   1980  1         2         ...
>   1980  1         3         ...
>   1980  2         1         ...
>   1980  2         2         ...
>   1980  2         3         ...
>
>   1990  1         1         ...
>   1990  1         2         ...
>   1990  1         3         ...
>   1990  2         1         ...
>   1990  2         2         ...
>   1990  2         3         ...
>
> I´d like to compute the mean rainfall for each YEAR * SITE combination.
>
> Kind regards,
>
> Miltinho
>
>
> ---------------------------------
>
>        [[alternative HTML version deleted]]
>
>
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>


-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390 (Cell)
+1 513 247 0281 (Home)

What is the problem you are trying to solve?

	[[alternative HTML version deleted]]

