is.na(v)<-b (was: Re: [R] Beginner's query - segmentation fault)
Simon Fear
Simon.Fear at synequanon.com
Wed Oct 8 13:48:27 CEST 2003
Well, that's a convincing argument, but maybe
it's the name that's worrying some of us. Maybe it would be
more intuitive if called set.na (sorry, I mean setNA).
Also "is.na<-" cannot be used to create a new variable of
NAs, so is not a universal method, which is a shame for its
advocates.
I note also that for a vector you can assign a new NA using
either TRUE or FALSE:
> a <- 1:3
> is.na(a[4])<-F
> a
[1] 1 2 3 NA
For a list, assigning F leaves the "new" element set to NULL.
Mind you, I suspect this would be a particularly stupid thing
to do, so I'm not going to lose any sleep over R's reaction to it.
>
> -----Original Message-----
> From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk]
> 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.
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