| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9d81e6d commit 7db13b9
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -46,6 +46,8 @@ | |||
| 46 | 46 | ||
| 47 | 47 | 7. `fread()` can now read from connections directly by spilling to a temporary file first, [#561](https://github.com/Rdatatable/data.table/issues/561). For the best throughput, point `tmpdir=` (or the global temp directory) to fast storage like an SSD or RAM. Thanks to Chris Neff for the report and @ben-schwen for the implementation. | |
| 48 | 48 | ||
| 49 | + 8. `frollapply()` no longer produces output longer than the input when the window length is also longer than the input [#7646](https://github.com/Rdatatable/data.table/issues/7646). Thanks to @hadley-johnson for reporting and @jangorecki for the fix. | ||
| 50 | + | ||
| 49 | 51 | ### Notes | |
| 50 | 52 | ||
| 51 | 53 | 1. {data.table} now depends on R 3.5.0 (2018). | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -278,8 +278,10 @@ frollapply = function(X, N, FUN, ..., by.column=TRUE, fill=NA, align=c("right"," | |||
| 278 | 278 | cpy = copy | |
| 279 | 279 | ansMask = function(len, n) { | |
| 280 | 280 | mask = rep(TRUE, len) | |
| 281 | - if (n) ## handle n==0 | ||
| 281 | + if (n) { ## handle n==0 | ||
| 282 | + n = min(n, len + 1L) # cap at len (bugfix #7646) | ||
| 282 | 283 | mask[seq_len(n-1L)] = FALSE | |
| 284 | + } | ||
| 283 | 285 | mask | |
| 284 | 286 | } | |
| 285 | 287 | tight0 = function(i, dest, src, n) FUN(dest, ...) ## skip memcpy when n==0 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2317,3 +2317,6 @@ test(6015.907, frolladapt(c(1L,3L,2L), 2L), error="be sorted, have no duplicates | |||
| 2317 | 2317 | test(6015.908, frolladapt(c(1L,2L,2L), 2L), error="be sorted, have no duplicates, have no NAs") | |
| 2318 | 2318 | test(6015.909, frolladapt(c(1L,2L,NA_integer_), 2L), error="be sorted, have no duplicates, have no NAs") ## loop that checks for sorted will detect NAs as well, except for first element | |
| 2319 | 2319 | test(6015.910, frolladapt(c(NA_integer_,1L,2L), 2L), error="be sorted, have no duplicates, have no NAs") ## first NA is detected by extra check | |
| 2320 | + | ||
| 2321 | + # frollapply can produce output longer than the input when the window-length is also longer than the input #7646 | ||
| 2322 | + test(6100.1, frollapply(c(1,2,3,4,5),N=7,FUN=sum), rep(NA, 5L)) | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments