[R] behaviour of all(NULL == c("a", "b"))

Matthias Burger matthias.burger at epigenomics.com
Wed Feb 9 16:42:17 CET 2005


Hi all,

I'm a little surprised at
 > NULL == c("a", "b")
logical(0)
 > all(NULL == c("a", "b"))
[1] TRUE

Reading the documentation for all() this was not clear for me to be expected.
Originally the question came up when using
 > match.arg(NULL, c("a", "b"))
[1] "a"
where I had thought an error would occur.

So could someone please help me and explain what I have overlooked.
Should I realy have to use is.null() as a precondition check here when a NULL
argument could arise.

Regards,

   Matthias


PS: the same behaviour occurs in R 1.9.1 and R 2.1.0 devel: 2005-02-07
 > version
          _
platform i686-pc-linux-gnu
arch     i686
os       linux-gnu
system   i686, linux-gnu
status
major    2
minor    0.1
year     2004
month    11
day      15
language R

-- 
Matthias Burger                     Project Manager/ Biostatistician
Epigenomics AG    Kleine Praesidentenstr. 1    10178 Berlin, Germany
phone:+49-30-24345-371                          fax:+49-30-24345-555
http://www.epigenomics.com           matthias.burger at epigenomics.com




More information about the R-help mailing list