From 67fd84e5468e26eda3ff01deb4010a8b3f8941a6 Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Fri, 23 Sep 2022 16:25:13 -0500 Subject: [PATCH] Fix for dev dplyr Both between() and %% are already vectorised so no need for sapply() here --- R/util_val.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/util_val.R b/R/util_val.R index f8bf7c3e..67eb7683 100644 --- a/R/util_val.R +++ b/R/util_val.R @@ -122,13 +122,13 @@ input.val <- function(input, num = TRUE, int = FALSE, req = FALSE, ## check if an input required is_null <- is.null(input) ## check integer - if(is_num) are_int <- all(sapply(input, function(z) z %% 1 == 0)) + if(is_num) are_int <- all(input %% 1 == 0) ## check length not greater than max allowed below_max <- length(input) <= max ## check length not less than min allowed above_min <- length(input) >= min ## check actual values within range - if(is_num) in_range <- all(sapply(input, function(z) dplyr::between(z, range[1], range[2]))) + if(is_num) in_range <- all(dplyr::between(as.numeric(input), range[1], range[2])) if(req && is_null) stop(glue::glue("{msg} input is required."))