To support this sort of functionality:
library(dplyr, warn.conflicts = FALSE)
quantile_df <- function(x, probs = c(0.25, 0.5, 0.75)) {
tibble(
"{{x}}_val" := quantile(x, probs),
"{{x}}_quant" := probs
)
}
df <- tibble(
grp = rep(1:3, each = 10),
x = runif(30),
y = rnorm(30)
)
df |>
group_by(grp) |>
summarise(across(x:y, quantile_df))
To support this sort of functionality: