Duncan Murdoch wrote:

On Tue, 07 Oct 2003 14:37:26 +0200, Uwe Ligges
<[EMAIL PROTECTED]> wrote :


2. Use "is.na(x) <- TRUE" instead of "x <- NA":
 is.na(temp[temp[ ,"t1"] == -999.00, "t1"]) <- TRUE


I hadn't heard this advice before.  The online help ?is.na gives this
cryptic advice:

     Function 'is.na<-' may provide a safer way to set missingness. It
     behaves differently for factors, for example.

I assume it means "safer than assigning NA", and "differently than
assigning NA", but how exactly is it safer, and how is it different?

Hmmmm. I was sure I had constructed an problematic example for a course I hold last year in Dortmund, but I cannot find it again. Maybe something for NA assignmets (into character vectors, I remember?) has been fixed in the meantime.


Anyway, I have had the experience that there are cases, where "is.na(x) <- TRUE" is the more secure way of doing it.

Additionally, it's mentioned in ?NA and in "S Programming", for example.

Uwe

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to