View source: R/fct_accumulate_for_days.R
accumulate_for_days | R Documentation |
given a vector accumulate the sum supposing each elements count for a given period of time.
accumulate_for_days(x, n)
x |
vector to accumulate |
n |
number of "times" each element count in the sum |
a vector of length length(x) + n -1
accumulate_for_days(c(1, 2, 3), 2) # c(1, 3, 5, 3)
accumulate_for_days(c(1, 2, 3), 3) # c(1, 3, 6, 5, 3)
accumulate_for_days(c(NA, 2, 3), 3) # c(0, 2, 5, 5, 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.