Re: [R] Calculating mean together with split

From: hadley wickham <h.wickham_at_gmail.com>
Date: Wed 20 Sep 2006 - 16:16:14 GMT

> # 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



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 and provide commented, minimal, self-contained, reproducible code. Received on Thu Sep 21 02:28:06 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 20 Sep 2006 - 17:30:05 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.