Dots (…) with variable title


I need to run a function like

f <- function(...) {
  l <- list(...)

x <- 'hortela'

if we do

f(hortela = 1)

we have the result 1 , which is expected.

How do I call f() using x instead of writing hortela manually?

PS: I don't want to modify f() .


I managed to solve it using and a named list., setNames(list(1), x))

does the work.

Scroll to Top