Skip to content
Prev 267802 / 398502 Next

Aggregating data

Hi:

This is the type of problem at which the plyr package excels. Write a
utility function that produces the plot you want using a data frame as
its input argument, and then do something like

library('plyr')
d_ply(results, .(a, b, c), plotfun)

where plotfun is a placeholder for the name of the name of your plot
function. The d in d_ply means to take a data frame as input and _
means return nothing. This is used in particular when a side effect,
such as a plot, is the desired 'output'. See
http://www.jstatsoft.org/v40/i01, which contains an example (baseball)
where groupwise plots are produced. (Don't actually run the example
unless you're willing to wait for 1100+ ggplots to be rendered :)

If memory serves, you should also be able to produce graphics for each
data subset using the data.table package as well.

If you want a more concrete solution, provide a more concrete example.

HTH,
Dennis
On Fri, Aug 5, 2011 at 9:55 AM, Jeffrey Joh <johjeffrey at hotmail.com> wrote: