[R] problem of data manipulation

hadley wickham h.wickham at gmail.com
Wed Jan 20 17:25:35 CET 2010


On Wed, Jan 20, 2010 at 8:43 AM, Matthew Dowle <mdowle at mdowle.plus.com> wrote:
> Sounds like a good idea. Would it be possible to give an example of how to
> combine plyr with data.table, and why that is better than a data.table only
> solution ?

Well, ideally, you'd do:

adt <- data.table(a)
ans2 <- ddply(a, c("var1", "var2", "var3"), subset, dt - min(dt) < 7)

and ddply would take care of the details.

Why would it be better?  Because plyr works for all data types: data
frames, lists and arrays.

Hadley

-- 
http://had.co.nz/



More information about the R-help mailing list