[R] Calculating mean together with split

hadley wickham h.wickham at gmail.com
Wed Sep 20 18:16:14 CEST 2006


> # Then try one of these:
>
> cast(dfm, year ~ sim)
> cast(dfm, year + sim ~ . )
> cast(dfm, year ~ sim, margins=TRUE)

Oops that should be:

dfm <- rename(df, c(DensPlants = "value"))

cast(dfm, year ~ sim, mean)
cast(dfm, year + sim ~ . , mean)
cast(dfm, year ~ sim, mean, margins=TRUE)

(Thanks for pointing that out Gabor!)

Hadley



More information about the R-help mailing list