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
+59Lines changed: 59 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,17 @@
8
8
9
9
1. Rolling functions `frollmean` and `frollsum` used to treat `Inf` and `-Inf` as `NA` when using default `algo="fast"`. It has been changed now and infinite values are not treated as `NA` anymore. If your input into those functions has `Inf` or `-Inf` then you will be affected by this change.
10
10
11
+
2.`frollapply` result is not coerced to numeric anymore. Users code could possibly break if it depends on forced coercion of input/output to numeric type.
12
+
```r
13
+
## before
14
+
frollapply(c(F,T,F,F,F,T), 2, any)
15
+
#[1] NA 1 1 0 0 1
16
+
17
+
## 1.18.0
18
+
frollapply(c(F,T,F,F,F,T), 2, any)
19
+
#[1] NA TRUE TRUE FALSE FALSE TRUE
20
+
```
21
+
11
22
### NEW FEATURES
12
23
13
24
1. New `sort_by()` method for data.tables, [#6662](https://github.com/Rdatatable/data.table/issues/6662). It uses `forder()` to improve upon the data.frame method and also match `DT[order(...)]` behavior with respect to locale. Thanks @rikivillalba for the suggestion and PR.
6. Function `frollapply` has been completely rewritten. Be sure to read `frollapply` manual before using the function. There are following changes:
71
+
72
+
- all basic types are now supported on input/output, not only double. Users code could possibly break if it depends on forced coercion of input/output to double type.
73
+
- new argument `by.column` allowing to pass a multi-column subset of a data.table into a rolling function, closes [#4887](https://github.com/Rdatatable/data.table/issues/4887).
# Sepal.Length Sepal.Width Petal.Length Petal.Width Species flow
84
+
# <num> <num> <num> <num> <fctr> <num>
85
+
# 1: 5.1 3.5 1.4 0.2 setosa NA
86
+
# 2: 4.9 3.0 1.4 0.2 setosa -3.039216
87
+
# 3: 4.7 3.2 1.3 0.2 setosa -3.240816
88
+
# 4: 4.6 3.1 1.5 0.2 setosa -3.121277
89
+
# 5: 5.0 3.6 1.4 0.2 setosa -3.513043
90
+
# ---
91
+
#146: 6.7 3.0 5.2 2.3 virginica -3.000000
92
+
#147: 6.3 2.5 5.0 1.9 virginica -2.559701
93
+
#148: 6.5 3.0 5.2 2.0 virginica -2.968254
94
+
#149: 6.2 3.4 5.4 2.3 virginica -3.446154
95
+
#150: 5.9 3.0 5.1 1.8 virginica -3.048387
96
+
```
97
+
98
+
- uses multiple CPU threads; evaluation of UDF is inherently slow so this can be a great help.
99
+
```r
100
+
x= rnorm(1e5)
101
+
n=500
102
+
setDTthreads(1)
103
+
system.time(
104
+
th1<- frollapply(x, n, median, simplify=unlist)
105
+
)
106
+
# user system elapsed
107
+
# 4.106 0.008 4.115
108
+
setDTthreads(4)
109
+
system.time(
110
+
th4<- frollapply(x, n, median, simplify=unlist)
111
+
)
112
+
# user system elapsed
113
+
# 5.778 0.140 1.498
114
+
all.equal(th1, th4)
115
+
#[1] TRUE
116
+
```
117
+
59
118
### BUG FIXES
60
119
61
120
1. Custom binary operators from the `lubridate` package now work with objects of class `IDate` as with a `Date` subclass, [#6839](https://github.com/Rdatatable/data.table/issues/6839). Thanks @emallickhossain for the report and @aitap for the fix.
0 commit comments