s-news
[Top] [All Lists]

Re: NA's in string vector.

To: Vadim Kutsyy <vkutsyy@cytokinetics.com>
Subject: Re: NA's in string vector.
From: Prof Brian D Ripley <ripley@stats.ox.ac.uk>
Date: Fri, 7 Dec 2001 06:43:18 +0000 (GMT)
Cc: "S-News (E-mail)" <s-news@lists.biostat.wustl.edu>
In-reply-to: <AA8349D6EED3D4118D74001083CF311AB24F3C@actin.cytokinetics.com>
On Thu, 6 Dec 2001, Vadim Kutsyy wrote:

> Is there a way to define NA's in string vector?
>
> > a<-c("a",NA,"b")
> > is.na(a)
> [1] F F F
> > a
> [1] "a"  "NA" "b"
> > a[2]<-NA
> > is.na(a)
> [1] F F F
>
> Splus converge all NA's to "NA", which make problem in data.frames.

Actually, that's a character vector, and for once the distinction matters.
Under S4, `string' is a separate class, and the way I know to do this is to
use the `string' class and is.na<-.  See the Green Book.

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


<Prev in Thread] Current Thread [Next in Thread>