[Rd] mget(missingArgument)?
William Dunlap
wdun|@p @end|ng |rom t|bco@com
Tue Jun 23 02:05:53 CEST 2020
Currently, when mget() is used to get the value of a function's argument
with no default value and no value in the call it returns the empty name
(R_MissingArg). Is that the right thing to do or should it return
'ifnotfound' or give an error?
E.g.,
> a <- (function(x) { y <- "y from function's environment";
mget(c("x","y","z"), envir=environment(), ifnotfound=666)})()
> str(a)
List of 3
$ x: symbol
$ y: chr "y from function's environment"
$ z: num 666
The similar function get0() gives an error in that case.
> b <- (function(x) get0("x", envir=environment(), ifnotfound=666))()
Error in get0("x", envir = environment(), ifnotfound = 666) :
argument "x" is missing, with no default
Bill Dunlap
TIBCO Software
wdunlap tibco.com
[[alternative HTML version deleted]]
More information about the R-devel
mailing list