[R] zoo:rollapply by multiple grouping factors
ggrothendieck at gmail.com
Mon Apr 4 21:54:34 CEST 2011
On Mon, Apr 4, 2011 at 3:40 PM, Mark Novak <mnovak1 at ucsc.edu> wrote:
> Thank you very much Gabor! It looks like that's gonna work wonderfully. I
> didn't even know 'ave' existed.
> For others out there: I only needed to add a comma: dat[,c("Site",
> "Plot", "Sp")]
Actually, if dd is a data frame dd[, ix] and dd[ix] give the same result. e.g.
> dd <- data.frame(a = 1:3, b = 11:13, c = 21:23)
> identical(dd[, c("b", "c")], dd[c("b", "c")])
> Small follow up Q: Is there any reason to use 'aggregate' vs. 'ave' in
aggregate reduces the data to fewer rows. ave adds a potentially
additional column to the original data.
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
email: ggrothendieck at gmail.com
More information about the R-help