[Rd] possible bug: NULL equality in lists.

Charles Dupont charles.dupont at vanderbilt.edu
Tue Mar 7 15:39:26 CET 2006


I was messing around with R and I found an example R behaving oddly:

a <- alist(NULL, "bob", c(3,6,2,3))
a
a == 'NULL'
a == "NULL"
a == 'cat'


If I create a list with a NULL value
  >a <- alist(NULL, "bob", c(3,6,2,3))
  >a
[[1]]
NULL

[[2]]
[1] "bob"

[[3]]
c(3, 6, 2, 3)

and run some tests on 'a', the '== "NULL' test returns TRUE for the NULL 
entry in the list 'a'.
  >a == 'NULL'
[1]  TRUE FALSE FALSE
  >a == "NULL"
[1]  TRUE FALSE FALSE
  >a == 'cat'
[1]  FALSE FALSE FALSE

This is consistent for every example of NULL's in a list that I can 
think of.

Is this a bug or undocumented correct behavior?

Here is my version output

platform i486-pc-linux-gnu
arch     i486
os       linux-gnu
system   i486, linux-gnu
status
major    2
minor    2.0
year     2005
month    10
day      06
svn rev  35749
language R


Thanks

Charles
-- 
Charles Dupont	Computer System Analyst		School of Medicine
		Department of Biostatistics	Vanderbilt University



More information about the R-devel mailing list