Hello,

I am searching for a function to calculate "partial" cumsums.

For example it should calculate the cumulative sums until a NA appears,
and restart the cumsum calculation after the NA.

this:

x <- c(1, 2, 3, NA, 5, 6, 7, 8, 9, 10)

should become this:

1 3 6 NA 5  11  18  26  35  45


any ideas?

thank you and best regards,

    stefan

______________________________________________
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