That definitely works, thanks.
I'm still confused though why the second example didn't work.
The documentation doesn't seem to give any qualifications about what functions it works and doesn't work with.
The big-bang operator !!! forces-splice a list of objects. The elements of the list are spliced in place, meaning that they each become one single argument.
vars <- syms(c("height", "mass"))
# Force-splicing is equivalent to supplying the elements separately
starwars %>% select(!!!vars)
starwars %>% select(height, mass)
Here is an even simpler example:
library(tidyverse)
# works
exec(mean, c(1, 2, NA, 3), !!!list(na.rm = TRUE))
#> [1] 2
# doesn't work
mean(c(1, 2, NA, 3), !!!list(na.rm = TRUE))
#> Error in !list(na.rm = TRUE): invalid argument type
# returns object I don't understand
quo(mean(c(1, 2, NA, 3), !!!list(na.rm = TRUE)))
#> <quosure>
#> expr: ^mean(c(1, 2, NA, 3), na.rm = TRUE)
#> env: global
expr(mean(c(1, 2, NA, 3), !!!list(na.rm = TRUE)))
#> mean(c(1, 2, NA, 3), na.rm = TRUE)
Created on 2021-06-17 by the reprex package (v1.0.0)