Skip to content

NULL assignment will change the expression's class into list

6 messages · Vitalie S., Duncan Murdoch

#
Vitalie Spinu wrote:
That's certainly an inconsistency, still present in a recent R-devel 
(but I haven't checked the latest beta).  I don't know if it's a bug:  
NULL assignments are handled specially in other situations (e.g. if te 
was a list to start, the NULL assignment would remove the "a" entry).

A simple workaround is to use

te["a"] <- expression(NULL)

or te <- te[-1]

instead, depending on what you expected to happen.

Duncan Murdoch
#
On 08/10/2010 12:24 PM, Vitalie Spinu wrote:
I think you're probably right.
Or simply follow te["a"] <- NULL

with

te <- as.expression(te)

This is a pretty fast operation if te is an expression or a list formed 
by mistaken conversion from one.

Duncan Murdoch
#
Vitalie Spinu wrote:
I don't know of any examples, but this is your construction.  I think 
it's very unlikely this will be fixed for 2.12.0, but it will probably 
be fixed for 2.12.1, if

1.  There is a 2.12.1

and

2.  It really isn't intentional behaviour.


Duncan Murdoch