[R] ggplot cumsum refined question (?)

hadley wickham h.wickham at gmail.com
Tue Oct 6 16:31:22 CEST 2009


> It is much easier to do you data preparation before plotting.
>
> Cummul <- ddply(subset(DF, precipitation!="NA"), "gauge_name",
> function(x){
>        x$Cummul <- cumsum(x$precipitation)
>        x
> })

With a little less typing:

Cummul <- ddply(subset(DF, precipitation!="NA"), "gauge_name", transform,
  Cummul = cumsum(precipitation))

Hadley

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




More information about the R-help mailing list