# [R] Newbie: how to calculate group averagege?

Mon Apr 10 12:58:25 CEST 2000

```Dear R-List,

I´m new in R, so I hope my question is not to primitive, but I haven´t
found a solution in the R-help. I´ve got a datatframe with 3 factors,
called xf (9 levels), yf (9 levels), zf (3 levels) and one variable
(rt):

> xf	yf	zf	rt
>  1	1	1	67
>  1	1	1	56
>  1    1       1       60
[...]
>  1    1       2       58
>  1    1       2       61
[...]
>  9    1       1       62
>  9    1       1       65
[...]
>  9    9       3       70

For each combinations of the factors are 6 values of rt. I need the mean
of the six rt values for each factor combination. I´ve tried the ave()
function:

> ave(rt, zf, xf, yf)

but it returns a lot of NAs. Is there another r-function I´ve overlooked
or must I write my own function?

Thanks,

Sven
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```