I am trying to write a function, which would allow to call various methods
and would pass to them extra arbitrary parameters.
My first attempt was to use call() as illustrated below, but apparently
'...' cannot be used in such context.
How can this be achieved ?
Best regards,
Ryszard
> myfun <- function(method, x, ...) {
+ v <- eval(call(method, x, ...))
+ }
> method = 'sqrt'
> myfun('sqrt',2)
Error in eval(call(method, x, ...)) : ... used in an incorrect context
> eval(call(method, 2, ...))
Error in eval(call(method, 2, ...)) : ... used in an incorrect context
> eval(call(method, 2))
[1] 1.414214
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html