Created
June 13, 2022 14:15
-
-
Save DavisVaughan/0cb7971dcf46cc64bc530f7a4b846b47 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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