[R] How to test for NULL?

John Fox jfox at mcmaster.ca
Fri Apr 25 00:19:50 CEST 2008


Dear Olivier,

You can use is.null(). 

apropos("null") finds is.null(), and help.search("null") turns up ?NULL,
which documents is.null().

I hope this helps,
 John

------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Olivier Lefevre
> Sent: April-24-08 5:19 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] How to test for NULL?
> 
> x == NULL returns logical(0) instead of FALSE or TRUE as you might
> expect
> and I cannot find the right way to write this test in R.
> 
> Thanks in advance for any hint,
> 
> -- O.L.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list