From 3fdf030738295f5b431cc38523e8b8fa583ff0a0 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Fri, 26 Dec 2025 10:32:55 -0800 Subject: [PATCH 1/2] Cycle deprecation of frollapply(x=, n=) --- NEWS.md | 4 ++++ R/frollapply.R | 6 ++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/NEWS.md b/NEWS.md index 28ef53c51..af4c510c8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,10 @@ ## data.table [v1.18.99](https://github.com/Rdatatable/data.table/milestone/37?closed=1) (in development) +### BREAKING CHANGE + +1. `x` and `n` arguments to `frollapply` functions no longer work. Use `X` and `N` instead, respectively; see the release note for 1.18.0, item 4 under `BREAKING CHANGE`. + ### Notes 1. {data.table} now depends on R 3.5.0 (2018). diff --git a/R/frollapply.R b/R/frollapply.R index 80bc65f7c..a8a214ff1 100644 --- a/R/frollapply.R +++ b/R/frollapply.R @@ -127,12 +127,10 @@ fixselfref = function(x) { frollapply = function(X, N, FUN, ..., by.column=TRUE, fill=NA, align=c("right","left","center"), adaptive=FALSE, partial=FALSE, give.names=FALSE, simplify=TRUE, x, n) { if (!missing(x)) { - warningf("'x' is deprecated in frollapply, use 'X' instead") - X = x + stopf("'x' is deprecated in frollapply, use 'X' instead") } if (!missing(n)) { - warningf("'n' is deprecated in frollapply, use 'N' instead") - N = n + stopf("'n' is deprecated in frollapply, use 'N' instead") } if (!isTRUEorFALSE(by.column)) stopf("'by.column' must be TRUE or FALSE") From 63c65c4c4d64e62a2c608fbbd0d8b99800be6cb9 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Fri, 26 Dec 2025 10:37:03 -0800 Subject: [PATCH 2/2] cycle deprecation tests --- inst/tests/froll.Rraw | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/inst/tests/froll.Rraw b/inst/tests/froll.Rraw index 489afcdad..ad5cb532f 100644 --- a/inst/tests/froll.Rraw +++ b/inst/tests/froll.Rraw @@ -1944,9 +1944,9 @@ test(6010.542, frollapply(1:2, 2, sum, adaptive=NA), error="must be TRUE or FALS test(6010.543, frollapply(1:2, 2, sum, partial=NA), error="must be TRUE or FALSE") test(6010.544, frollapply(1:2, 2, sum, give.names=NA), error="must be TRUE or FALSE") test(6010.545, frollapply(1:2, 2, sum, simplify=NA), error="must be TRUE or FALSE or a function") -test(6010.561, frollapply(x=1:2, N=2, FUN=sum), c(NA,3L), warning="'x' is deprecated in frollapply, use 'X' instead") -test(6010.562, frollapply(X=1:2, n=2, FUN=sum), c(NA,3L), warning="'n' is deprecated in frollapply, use 'N' instead") -test(6010.563, frollapply(x=1:2, n=2, FUN=sum), c(NA,3L), warning=c("'x' is deprecated in frollapply, use 'X' instead","'n' is deprecated in frollapply, use 'N' instead")) +test(6010.561, frollapply(x=1:2, N=2, FUN=sum), error="'x' is deprecated in frollapply, use 'X' instead") +test(6010.562, frollapply(X=1:2, n=2, FUN=sum), error="'n' is deprecated in frollapply, use 'N' instead") +# 6010.563 tested both x= and n= resulting in 2 warnings, but with errors, that's not very useful. test(6010.564, frollapply(1:2, c("a","a"), length, adaptive=TRUE), error="'N' must be an integer vector or list of integer vectors") test(6010.565, frollapply(1:2, list(c("a","a")), length, adaptive=TRUE), error="'N' must be an integer vector or list of integer vectors") test(6010.566, frollapply(1:2, 2, length, by.column=FALSE), error="frollapply by.column=FALSE requires 'X' argument to be")