is.na(v)<-b (was: Re: [R] Beginner's query - segmentation fault)

Simon Fear Simon.Fear at synequanon.com
Wed Oct 8 12:08:51 CEST 2003


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?
 

Simon Fear
Senior Statistician
Syne qua non Ltd
Tel: +44 (0) 1379 644449
Fax: +44 (0) 1379 644445
email: Simon.Fear at synequanon.com
web: http://www.synequanon.com
 
Number of attachments included with this message: 0
 
This message (and any associated files) is confidential and\...{{dropped}}




More information about the R-help mailing list