thank u very much Wiliam Dunlap,
your function is very helpful, i been trying to find the right algo,,,and i
saw yours, it works perfectly.
i even checked with system.time function, and it's clear the cum.reset is
the best.

> system.time(ave(J, rev(cumsum(rev(is.na(J)))), FUN=cumsum)) 
utilisateur     système      écoulé 
       0.18        0.00        0.19 
> system.time(cumsum.reset(J))
utilisateur     système      écoulé 
          0           0           0 

thks  

--
View this message in context: 
http://r.789695.n4.nabble.com/partial-cumsum-tp899789p3560134.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to