Is it possible to create a ellipsis (...) from a list? The idea is to be able to do something like:
mylist <- list(a=1,b=2,c=3)
myellipsis <- create_ellipsis(mylist)
print(switch('a', myellipsis)) # output 1
You want do.call
, which can pass the content of a list to a functions ...
argument:
do.call(function(...) print(switch('a', ...)), mylist)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With