Skip to content

Instantly share code, notes, and snippets.

@DavisVaughan
Created June 13, 2022 14:15
Show Gist options
  • Save DavisVaughan/0cb7971dcf46cc64bc530f7a4b846b47 to your computer and use it in GitHub Desktop.
Save DavisVaughan/0cb7971dcf46cc64bc530f7a4b846b47 to your computer and use it in GitHub Desktop.
f1 <- function(...) {
data <- list(a = 100)
# Optionally, for performance if calling `eval_tidy()` a lot:
# data <- as_data_mask(data)
dots <- rlang::enquos(...)
n_dots <- length(dots)
out <- vector("list", length = n_dots)
for (i in seq_len(n_dots)) {
out[[i]] <- rlang::eval_tidy(dots[[i]], data = data)
}
out
}
a <- 0
b <- 5
f1(a + b, a + 1000)
#> [[1]]
#> [1] 105
#>
#> [[2]]
#> [1] 1100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment