[Rd] What do you call the value that represents a missing argument?
Peter Dalgaard
pdalgd at gmail.com
Sat Oct 9 17:24:07 CEST 2010
On 10/09/2010 01:51 PM, Hadley Wickham wrote:
>> It is a 'dotted pair list'
>
> But:
>
>> is.pairlist(formals(plot)$x)
> [1] FALSE
>
> Hadley
>
Vitaly is right that it is implemented as as.symbol(""), although
there's a safeguard against doing just that (and it is not like it is
imperative to have that particular implementation). It isn't really
supposed to live in the wild, but as you have noticed there are a couple
of ways to circumvent the safeguards, mainly due to the need to be able
to manipulate a function's argument list.
We did at some point play around with the idea of making "missing arg"
an official first-class object, but found ourselves in the same position
as the man who invented the acid that dissolves everything: These things
are hard to store....
> y <- alist(x=)$x
> z <- y
Error: argument "y" is missing, with no default
(I have forgotten whether there's a reason that the above doesn't fail
already on the assignment to y. Somehow it would have been more logical
if missing values could _only_ appear inside lists. Except in actual
function arguments, of course.)
--
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Phone: (+45)38153501
Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
More information about the R-devel
mailing list