[19087] in s-news-athena
[S] logical and numeric NA's
daemon@ATHENA.MIT.EDU (Babette Brumback)
Wed Sep 1 17:43:44 1999
Date: Wed, 1 Sep 1999 14:39:47 -0700 (PDT)
From: Babette Brumback <brumback@biostat.washington.edu>
To: s-news@wubios.wustl.edu
Message-Id: <Pine.GSO.4.10.9909011425290.21632-100000@gibson1>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Does anyone out there know the rationale for having two different types
of NA, one "logical" and the other "numeric"? In the past I have used
the expression a=="NA" to screen for missing data, but recently I
noticed that the numeric type of NA returns "F". This oddity is
clearly illustrated with the following example:
> a
[1] NA
> b
[1] NA
> is.na(a)
[1] T
> is.na(b)
[1] T
> a=="NA"
[1] F
> b=="NA"
[1] T
> a==NA
[1] NA
> b==NA
[1] NA
> mode(a)
[1] "numeric"
> mode(b)
[1] "logical"
Having wasted a few hours getting to the root of the problem, I
am left wondering why it is necessary to have two types of NA's.
Also, am I right to presume that replacing expressions of the
type
a=="NA"
with
is.na(a)
circumvents all related oddities? Or might there linger other
as yet unrevealed types of NA?
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news