Thanks Ian (and others),
Taking the advice of ?"..." (which I should have done at the outset ...
duhh!), the following seems to be the simplest solution, adequate for my
needs at least:
f <- function(x, ...){
lapply(seq_along(x), \(i)switch(x[i], ..., NA))
}
(the usual argument checking etc.
I might add that there seems to be a subtle difference between using
`...elt()` and `match.call()`, which is that the former causes `a` itself
to be evaluated while the latter doesn't:
```
# Some approaches that have been suggested:
# 1. Using `list()` (Bert Gunter)
f1 <- function(...) list(...)[[
2 matches
Mail list logo