Skip to content

Commit 50061db

Browse files
committed
frolladapt nicer news example
1 parent 85ec622 commit 50061db

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

NEWS.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -225,36 +225,36 @@
225225

226226
18. New `frolladapt` helper function has been added to aid in preparation of adaptive length of rolling window width when dealing with _irregularly spaced ordered data_. This lets the user to apply a rolling function over a period without having to deal with gaps in a data where some periods might be missing, [#3241](https://github.com/Rdatatable/data.table/issues/3241). Thanks to @jangorecki for implementation.
227227
```r
228-
idx = as.Date("2022-10-23") + c(0,1,4,5,6,7,9,10,14)
228+
idx = as.Date("2025-09-08") + c(0,1,4,5,6,7,9,10,14)
229229
dt = data.table(index=idx, value=seq_along(idx))
230230
dt
231231
# index value
232232
# <Date> <int>
233-
#1: 2022-10-23 1
234-
#2: 2022-10-24 2
235-
#3: 2022-10-27 3
236-
#4: 2022-10-28 4
237-
#5: 2022-10-29 5
238-
#6: 2022-10-30 6
239-
#7: 2022-11-01 7
240-
#8: 2022-11-02 8
241-
#9: 2022-11-06 9
233+
#1: 2025-09-08 1
234+
#2: 2025-09-09 2
235+
#3: 2025-09-12 3
236+
#4: 2025-09-13 4
237+
#5: 2025-09-14 5
238+
#6: 2025-09-15 6
239+
#7: 2025-09-17 7
240+
#8: 2025-09-18 8
241+
#9: 2025-09-22 9
242242
dt[, c("rollmean3","rollmean3days") := list(
243243
frollmean(value, 3),
244244
frollmean(value, frolladapt(index, 3), adaptive=TRUE)
245245
)]
246246
dt
247247
# index value rollmean3 rollmean3days
248248
# <Date> <int> <num> <num>
249-
#1: 2022-10-23 1 NA NA
250-
#2: 2022-10-24 2 NA NA
251-
#3: 2022-10-27 3 2 3.0
252-
#4: 2022-10-28 4 3 3.5
253-
#5: 2022-10-29 5 4 4.0
254-
#6: 2022-10-30 6 5 5.0
255-
#7: 2022-11-01 7 6 6.5
256-
#8: 2022-11-02 8 7 7.5
257-
#9: 2022-11-06 9 8 9.0
249+
#1: 2025-09-08 1 NA NA
250+
#2: 2025-09-09 2 NA NA
251+
#3: 2025-09-12 3 2 3.0
252+
#4: 2025-09-13 4 3 3.5
253+
#5: 2025-09-14 5 4 4.0
254+
#6: 2025-09-15 6 5 5.0
255+
#7: 2025-09-17 7 6 6.5
256+
#8: 2025-09-18 8 7 7.5
257+
#9: 2025-09-22 9 8 9.0
258258
```
259259

260260
### BUG FIXES

0 commit comments

Comments
 (0)