powered by
Calculate the cumulative summation of a numeric vector with revised NA handling compared to `base::cumsum()`.
calc_cumsum(x, na.fill = FALSE)
A vector of the same length and type as x.
A numeric.
A logical. Impute forward for NA values.
x <- 1:10 x[3:4] <- NA # Calculate cumsum & replace NA values calc_cumsum(x, na.fill = TRUE)
Run the code above in your browser using DataLab