Closed bnicenboim closed 2 months ago
library(tidytable)
Using a list with functions does not work with across.
across
mean_var <- list(mean = ~ mean(., na.rm = TRUE), var = ~ var(., na.rm = TRUE)) td <- tidytable(a = runif(100), b = runif(100)) td |> summarize(across(everything(), mean_var)) #> Error in mean_var(a): could not find function "mean_var"
It works in dplyr:
dplyr
td |> dplyr::summarize(across(everything(), mean_var)) #> a_mean a_var b_mean b_var #> 1 0.4836208 0.07956486 0.4964107 0.07229442
Created on 2024-08-30 with reprex v2.1.1
Unfortunately passing a premade list to to across() is something that isn’t possible in tidytable and will always be a limitation of its implementation
across()
Using a list with functions does not work with
across
.It works in
dplyr
:Created on 2024-08-30 with reprex v2.1.1