Firstly, let me express my sincere appreciation for this package. It's been super helpful when dealing with rolling measure on date data with gaps.
I came across a behaviour that seemed strange to me and I wanted to check my understanding (and maybe report a bug).
The following reprex shows the issue I've encounted.
library(data.table)
dt <- data.table(
date = as.Date(c("2025-07-01", "2025-08-01", "2025-09-01")),
b = c(10, 20, 30)
)
dt[,
let(
rolling_2m= runner(x=b, k = "2 months", idx = date, f = sum, na_pad = TRUE))]
dt
# date b rolling_2m
# <Date> <num> <num>
# 1: 2025-07-01 10 NA
# 2: 2025-08-01 20 NA
# 3: 2025-09-01 30 50
I'm curious to understand why the second record doesn't end up with a value in rolling_2m when it's the second month. Any guidance here would be appreciated.
Firstly, let me express my sincere appreciation for this package. It's been super helpful when dealing with rolling measure on date data with gaps.
I came across a behaviour that seemed strange to me and I wanted to check my understanding (and maybe report a bug).
The following reprex shows the issue I've encounted.
I'm curious to understand why the second record doesn't end up with a value in
rolling_2mwhen it's the second month. Any guidance here would be appreciated.