[Rd] dput(as.list(function...)...) bug
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Tue Mar 24 08:52:58 CET 2009
Duncan Murdoch wrote:
> On 23/03/2009 7:37 PM, Stavros Macrakis wrote:
> It appears to be the
>> zero-length name:
>>
>> is.name(ff$x) => TRUE
>> as.character(ff$x) => ""
>
> This may give you a hint:
>
> > y <- ff$x
> > y
> Error: argument "y" is missing, with no default
>
> It's a special internal thing that triggers the missing value error when
> evaluated. It probably shouldn't be user visible at all.
Yes, it actually is the zero-length name that is being used for this,
but that is not really useful knowledge because it is forbidden to
create them as `` or as.name(""). We did briefly consider making the
missing object a real R object, but the semantics are too weird:
Basically, you can only assign it once, next time you get errors:
> x <- alist(a=)$a
> missing(x)
[1] TRUE
> y <- x
Error: argument "x" is missing, with no default
> l <- alist(a=, b=2)
> l$b <- x
Error: argument "x" is missing, with no default
And, as you think about it, you realize that you cannot disable these
mechanisms, because _something_ has to trap use of missing arguments.
It does actually work to define a function mvi() which returns the
missing value indicator and have things like
> list(x= mvi(), b= quote(!x))
$x
$b
!x
work. I'd hate writing its help page, though.
--
O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-devel
mailing list