@@ -376,8 +376,8 @@ epi_slide <- function(x, f, ..., before, after, ref_time_values,
376376# ' @template opt-slide-details
377377# '
378378# ' @importFrom dplyr bind_rows mutate %>% arrange tibble select
379- # ' @importFrom rlang enquo quo_get_expr as_label
380- # ' @importFrom purrr map
379+ # ' @importFrom rlang enquo quo_get_expr as_label expr_label caller_arg
380+ # ' @importFrom purrr map map_lgl
381381# ' @importFrom data.table frollmean frollsum frollapply
382382# ' @importFrom lubridate as.period
383383# ' @importFrom checkmate assert_function
@@ -459,25 +459,25 @@ epi_slide_opt <- function(x, col_names, f, ..., before, after, ref_time_values,
459459 # `data.table` and `slider` (or a function that has the exact same
460460 # definition, e.g. if the function has been reexported or defined
461461 # locally).
462- if (any(sapply (
463- c (frollmean , frollsum , frollapply ),
462+ if (any(map_lgl (
463+ list (frollmean , frollsum , frollapply ),
464464 function (roll_fn ) {
465- isTRUE( identical(f , roll_fn ) )
465+ identical(f , roll_fn )
466466 }
467467 ))) {
468468 f_from_package <- " data.table"
469- } else if (any(sapply (
470- c (slide_sum , slide_prod , slide_mean , slide_min , slide_max , slide_all , slide_any ),
469+ } else if (any(map_lgl (
470+ list (slide_sum , slide_prod , slide_mean , slide_min , slide_max , slide_all , slide_any ),
471471 function (roll_fn ) {
472- isTRUE( identical(f , roll_fn ) )
472+ identical(f , roll_fn )
473473 }
474474 ))) {
475475 f_from_package <- " slider"
476476 } else {
477477 # `f` is from somewhere else and not supported
478478 cli_abort(
479479 c(
480- " slide function `f` is not supported " ,
480+ " problem with {rlang::expr_label(rlang::caller_arg(f))} " ,
481481 " i" = " `f` must be one of `data.table`'s rolling functions (`frollmean`,
482482 `frollsum`, `frollapply`. See `?data.table::roll`) or one of
483483 `slider`'s specialized sliding functions (`slide_mean`, `slide_sum`,
0 commit comments