Multiple names
- There is no plural of the
.data
pronoun (SNARKY ASIDE: but isn’t data gramatically plural…?) - But if target function accepts tidy select, use
all_of()
- And if not, might need either
- bridge pattern
- symbolize-and-inject
Example of all_of()
# NOTE: this is already a bridge pattern...
vars <- c("cyl", "am")
mtcars %>% tidyr::pivot_longer(
# `all_of()` takes characters: https://tidyselect.r-lib.org/reference/all_of.html#ref-usage
# but exhibits tidy-select behavior
# which is what tidyr::pivot_longer expects for `cols`: https://tidyr.tidyverse.org/reference/pivot_longer.html#arguments
cols = all_of(vars)
)