You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: NEWS.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -246,7 +246,7 @@
246
246
#9: 2025-09-22 9 8 9.0
247
247
```
248
248
249
-
19.Newrollingfunctions:`frollmin`, `frollprod`and`frollmedian`, havebeenimplemented, towards [#2778](https://github.com/Rdatatable/data.table/issues/2778). Thanks to @jangorecki for implementation. Implementation of rolling median is based on a novel algorithm "sort-median" described by [@suomela](https://github.com/suomela) in his 2014 paper [Median Filtering is Equivalent to Sorting](https://arxiv.org/abs/1406.1717). "sort-median" scales very well, not only for size of input vector but also for size of rolling window.
249
+
19.Othernewrollingfunctions:`frollmin`, `frollprod`, `frollmedian`, `frollvar`and`frollsd`, havebeenimplemented, resolvinglongstandingissue [#2778](https://github.com/Rdatatable/data.table/issues/2778). Thanks to @jangorecki for implementation. Implementation of rolling median is based on a novel algorithm "sort-median" described by [@suomela](https://github.com/suomela) in his 2014 paper [Median Filtering is Equivalent to Sorting](https://arxiv.org/abs/1406.1717). "sort-median" scales very well, not only for size of input vector but also for size of rolling window.
test(6001.7241, frollvar(adaptive=TRUE, c(1:2,NA), c(2,2,2), has.nf=FALSE), c(NA_real_,0.5,NA_real_), warning="used but non-finite values are present in input")
1434
+
test(6001.7242, frollvar(adaptive=TRUE, c(1:2,NA), c(2,2,2)), c(NA_real_,0.5,NA_real_), options=c("datatable.verbose"=TRUE), output="propagates NFs properply, no need to re-run")
1435
+
test(6001.7243, frollvar(adaptive=TRUE, c(1:2,NA), c(2,2,2), na.rm=TRUE), c(NA_real_,0.5,NA_real_), options=c("datatable.verbose"=TRUE), output="re-running with extra care for NFs")
test(6001.8193, frollsd(c(1:2,NA), 2, has.nf=FALSE), c(NA,sqrt(0.5),NA), warning="used but non-finite values are present in input")
1472
+
test(6001.8194, frollsd(c(NA,2:3), 2, has.nf=FALSE), c(NA,NA,sqrt(0.5)), warning="used but non-finite values are present in input")
1473
+
test(6001.8195, frollsd(c(NA,2:3), 2), c(NA,NA,sqrt(0.5)), options=c("datatable.verbose"=TRUE), output="skip non-finite inaware attempt and run with extra care")
1474
+
test(6001.8196, frollsd(c(NA,2:3), 2, has.nf=FALSE, algo="exact"), c(NA,NA,sqrt(0.5)), warning="used but non-finite values are present in input")
1475
+
test(6001.8197, frollsd(c(NA,2:3), 2, algo="exact", na.rm=TRUE), c(NA,NA,sqrt(0.5)), options=c("datatable.verbose"=TRUE), output="re-running with extra care for NF")
1476
+
test(6001.8201, frollsd(adaptive=TRUE, 1:3, c(2,2,2)), c(NA,sqrt(0.5),sqrt(0.5)), options=c("datatable.verbose"=TRUE), output="frolladaptivefun: algo 0 not implemented, fall back to 1")
DT_trunc = copy(DT)[, times := as.POSIXct(trunc(times))]
17079
17079
tmp = tempfile()
17080
17080
## ISO8601 format (%FT%TZ) by default
17081
-
fwrite(DT, tmp)
17082
-
test(2150.01, fread(tmp), DT) # defaults for fwrite/fread simple and preserving
17083
-
fwrite(DT, tmp, dateTimeAs='write.csv') # as write.csv, writes the UTC times as-is not local because the time column has tzone=="UTC", but without the Z marker. Also truncates milliseconds, hence DT_trunc below.
17084
-
test(2150.021, env=list(TZ=NULL), sapply(fread(tmp,tz=""), typeof), c(dates="integer", times="character")) # from v1.14.0 tz="" needed to read datetime as character
17085
-
test(2150.022, env=list(TZ=NULL), fread(tmp,tz="UTC"), DT_trunc) # user can tell fread to interpret the unmarked datetimes as UTC
17086
-
test(2150.023, env=c(TZ='UTC'), fread(tmp), DT_trunc) # TZ environment variable is also recognized
17087
-
if (.Platform$OS.type!="windows") {
17088
-
test(2150.024, env=c(TZ=''), fread(tmp), DT_trunc) # on Windows this unsets TZ, see ?Sys.setenv
17089
-
# blank TZ env variable on non-Windows is recognized as UTC consistent with C and R; but R's tz= argument is the opposite and uses "" for local
17090
-
}
17081
+
local({
17082
+
old=options(digits.secs=0); on.exit(options(old))
17083
+
fwrite(DT, tmp)
17084
+
test(2150.01, fread(tmp), DT) # defaults for fwrite/fread simple and preserving
17085
+
fwrite(DT, tmp, dateTimeAs='write.csv') # as write.csv, writes the UTC times as-is not local because the time column has tzone=="UTC", but without the Z marker. Also truncates milliseconds, hence DT_trunc below.
17086
+
test(2150.021, env=list(TZ=NULL), sapply(fread(tmp,tz=""), typeof), c(dates="integer", times="character")) # from v1.14.0 tz="" needed to read datetime as character
17087
+
test(2150.022, env=list(TZ=NULL), fread(tmp,tz="UTC"), DT_trunc) # user can tell fread to interpret the unmarked datetimes as UTC
17088
+
test(2150.023, env=c(TZ='UTC'), fread(tmp), DT_trunc) # TZ environment variable is also recognized
17089
+
if (.Platform$OS.type!="windows") {
17090
+
test(2150.024, env=c(TZ=''), fread(tmp), DT_trunc) # on Windows this unsets TZ, see ?Sys.setenv
17091
+
# blank TZ env variable on non-Windows is recognized as UTC consistent with C and R; but R's tz= argument is the opposite and uses "" for local
17092
+
}
17093
+
})
17091
17094
# Notes:
17092
17095
# - from v1.14.0 tz="" needed
17093
17096
# - as.POSIXct puts "" on the result (testing the write.csv version here with missing tzone)
0 commit comments