Skip to content
Back to formatted view

Raw Message

Message-ID: <BANLkTi=iiTcm9_R1FtHmT=QaB+XJTZWvkA@mail.gmail.com>
Date: 2011-04-04T19:54:34Z
From: Gabor Grothendieck
Subject: zoo:rollapply by multiple grouping factors
In-Reply-To: <4D9A1EA9.1010203@ucsc.edu>

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")])
[1] TRUE

> Small follow up Q: ?Is there any reason to use 'aggregate' vs. 'ave' in
> general?

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.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com