On Wed, 8 Oct 2003, Simon Fear wrote: > Note this behaviour: > > > a<-"a" > > a<-NA > > mode(a) > [1] "logical" > > a<-"a" > > is.na(a) <- T > > mode(a) > [1] "character" > > However after either way of assigning NA to a, is.na(a) is true, > and it prints as NA, so I can't see it's ever likely to matter. [Why > do I say these things? Expect usual flood of examples where it > does matter.] > > Also if a is a character vector, a[2] <- NA coerces the NA to > as.character(NA); again, just as one would hope/expect. > > I have to echo Richard O'K's remark: if <- NA can ever go wrong, > is that not a bug rather than a feature?
I don't think it can ever `go wrong', but it can do things other than the user intends. The intention of is.na<- is clearer, and so perhaps user error is less likely? That is the thinking behind the function, anyway. -- Brian D. Ripley, [EMAIL PROTECTED] 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 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help