Skip to content
Prev 322933 / 398502 Next

Why can't R understand if(num!=NA)?

On May 3, 2013, at 10:24 AM, jpm miao <miaojpm at gmail.com> wrote:

            
NA is undefined:
[1] NA
[1] NA


Therefore the equality you are attempting does not return a TRUE or FALSE result, it is unknown and NA is returned. ?is.na was designed specifically to test for the presence of an NA value and return a TRUE or FALSE result which can then be tested.

See: http://cran.r-project.org/doc/manuals/r-release/R-intro.html#Missing-values


Regards,

Marc Schwartz