I would like to write a more or less general calling targetf object that will keep its default settings.
Suppose we have provided some third-party targetf library:
targetf<-function(x=1,...){ print(paste("x =",x)) }
How to write wrapperf that respects the default arguments of targetf , so calling wrapperf() will not give the error message Error in paste("x =", x) : argument "x" is missing, with no default ?
The obvious candidate wrapperf1<-function(x,y) {targetf(x=x)} does not work and does not work with wrapperf1() .
wrapperf2<-function(...) {targetf(...)} behaves correctly, but for me it does not work, because I only need to pass the argument x (and, possibly, reserve ... for other functions in the body wrapperf ).
Perhaps to solve the problem I will have to play with ellipsis filtering, which is now terra incognita for me ...
One idea on how to solve the problem: maybe I will need to create a specially created object ... from scratch in wrapperf to make pseudo-code like this:
wrapperfX<-function(x,y,...) { ...<-if(missing(x){ list() }else{ list(x=x) } targetf(...) }
But I have no idea how to even begin to carry out tasks in the ellipsis ... maybe at all? I posed this question separately on SO: Is it possible to create an object with an ellipsis ( β¦ ) .
Since the problem has not yet been resolved, I decided to post this question to r-help@r-project.org