[R] Using names in function with ellipsis (non standard evaluation?)
Luca Cerone
luca.cerone at gmail.com
Thu May 28 19:40:39 CEST 2015
Hi everybody,
this is probably a silly question, but I can't find a way to recognize
the names that are passed
to variables in ellipsis.
For example, say I have a "core" function that receives some extra
parameters through ...
e.g.
f <- function(...) {
params <- c(...)
#dothehardworkhere using "names(params)"
}
and then I want to create a function g where some of the parameters
are set like:
g <- function(x,y) f(x,y)
I figure I probably have to use to substitute in f, but it is not
clear to me how.
Definitely what I need to achieve is that when I call:
g(1,2) then in f params is the vector c(x=1,y=2);
similarly I want to be able to call g(y=2, x=1)
and have params = c(x=1,y=2) in f.
Can you please help me understanding how to do this?
Thanks a lot for your help!
Cheers,
Luca
More information about the R-help
mailing list