You can do it like this: > as.missing <- force > g <- function(x = as.missing()) missing(x) > g(3) [1] FALSE > g() [1] TRUE
On 10/24/06, Paul Gilbert <[EMAIL PROTECTED]> wrote: > (I'm not sure if this is a request for a feature, or another instance > where a feature has eluded me for many years.) > > Often I have a function which calls other functions, and may often use > the default arguments to those functions, but needs the capability to > pass along non-default choices. I usually do this with some variation on > > foo <- function(x, foo2Args=NULL or a list(foo2defaults), > foo3Args=NULL or a list(foo3defaults)) > > and then have logic to check for NULL, or use the list in combination > with do.call. It is also possible to do this with ..., but it always > seems a bit dangerous passing all the unnamed arguments along to all the > functions being called, especially when I always seem to be calling > functions that have similar arguments (maxit, eps, start, frequency, etc). > > It is a situation I have learned to live with, but one of my > co-maintainers just pointed out to me that there should be a good way to > do this in R. Perhaps there is something else I have missed all these > years? Is there a way to do this cleanly? It would be nice to have > something like > > foo <- function(x, foo2Args=as.missing(), foo3Args=as.missing()) > > then the call to foo2 and foo3 could specify foo2Args and foo3Args, but > these would get treated as if they were missing, unless they are given > other values. > > Paul Gilbert > ==================================================================================== > > La version française suit le texte anglais. > > ------------------------------------------------------------------------------------ > > This email may contain privileged and/or confidential inform...{{dropped}} > > ______________________________________________ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel