[R] Newbie: how to calculate group averagege?
garbade at psy.uni-muenchen.de
Mon Apr 10 13:47:50 CEST 2000
Thanks a lot, this is exactly what I need.
Peter Dalgaard BSA wrote:
> Sven Garbade <garbade at psy.uni-muenchen.de> writes:
> > 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?
> I think you're looking for
> tapply(rt,list(zf, xf, yf), mean, na.rm=T)
> ave(rt, zf, xf, yf, FUN=function(x)mean(x,na.rm=T))
> O__ ---- Peter Dalgaard Blegdamsvej 3
> c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
> (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
> ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
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