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
|