[R] aggregate() runs out of memory
Sam Steingold
sds at gnu.org
Mon Nov 26 21:13:33 CET 2012
Hi,
> * Steve Lianoglou <znvyvatyvfg.ubarlcbg at tznvy.pbz> [2012-11-19 13:30:03 -0800]:
>
> For instance, if you want the min and max of `delay` within each group
> defined by `share.id`, and let's assume `infl` is a data.frame, you
> can do something like so:
>
> R> as.data.table(infl)
> R> setkey(infl, share.id)
> R> result <- infl[, list(min=min(delay), max=max(delay)), by="share.id"]
perfect, thanks.
alas, the resulting table does not contain the share.id column.
do I need to add something like "id=unique(share.id)" to the list?
also, if there is a field in the original table infl which only depends
on share.id, how do I add this unique value to the summary?
it appears that "count=unique(country)" in list() does what I need, but
it slows down the process.
--
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://openvotingconsortium.org http://jihadwatch.org
http://thereligionofpeace.com http://palestinefacts.org http://dhimmi.com
Why use Windows, when there are Doors?
More information about the R-help
mailing list