Skip to content

R-alpha: Playing the tag game

1 message · Peter Dalgaard

#
Here are a handful of oddities in pre0.50-7 (at some risk of reprisals
from people waiting for the real 0.50...):

I was mucking about trying to figure out how to know which tags has
been used in a function call, and some weird stuff happened.

----------
A call with tagged arguments is something like a list, the tags
can be used to access elements, but the names attribute is absent,
until the call is coerced to a list. (Attempting to set the names()
causes evaluation. Changing "list" to "blipblop" causes an 'Error:
couldn't find function "blipblop"' at that point.)
list(a = 1, b = 2)
[1] 2
NULL
[[1]]
[1] 1

[[2]]
[1] 2
-----------
This one is plainly a bug. Meaningless, but...

[Previously saved workspace restored]
Segmentation fault (core dumped)
------------
Strange... as.call should return its argument if is.call is true?
list(a = 1, b = 2)
Error in as.call(j) : invalid argument list
[1] TRUE

------------
Ok, the right solution seems to be names(as.list(j)), but then we run
into some other fun with NA's... Shouldn't the real NA print without
quotes?
[1] FALSE FALSE FALSE
[1] "NA" "a"  "b"
[1] TRUE
[1]  TRUE FALSE FALSE