Skip to content

Commit 5d14ddd

Browse files
committed
deprecate n_args arg for checking if computation f takes enough args
1 parent 8bfb4d8 commit 5d14ddd

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

R/grouped_epi_archive.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ grouped_epi_archive =
223223

224224
# Check that `f` takes enough args
225225
if (!missing(f) && is.function(f)) {
226-
check_sufficient_f_args(f, 3L)
226+
check_sufficient_f_args(f)
227227
}
228228

229229
# Validate and pre-process `before`:

R/slide.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ epi_slide = function(x, f, ..., before, after, ref_time_values,
159159

160160
# Check that `f` takes enough args
161161
if (!missing(f) && is.function(f)) {
162-
check_sufficient_f_args(f, 3L)
162+
check_sufficient_f_args(f)
163163
}
164164

165165
if (missing(ref_time_values)) {

R/utils.R

+2-3
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,10 @@ Warn = function(msg, ...) rlang::warn(break_str(msg, init = "Warning: "), ...)
104104
#'
105105
#' @param f Function; specifies a computation to slide over an `epi_df` or
106106
#' `epi_archive` in `epi_slide` or `epix_slide`.
107-
#' @param n_mandatory_f_args Integer; specifies the number of arguments `f`
108-
#' is required to take before any `...` arg. Defaults to 2.
109107
#'
110108
#' @noRd
111-
check_sufficient_f_args <- function(f, n_mandatory_f_args = 2L) {
109+
check_sufficient_f_args <- function(f) {
110+
n_mandatory_f_args <- 3L
112111
arg_names = names(formals(args(f)))
113112
if ("..." %in% arg_names) {
114113
# Keep all arg names before `...`

0 commit comments

Comments
 (0)