[Rd] Re: [R] Several R vs S-Plus issues

Thomas Lumley tlumley@u.washington.edu
Thu, 4 Oct 2001 11:31:52 -0700 (PDT)

On Thu, 4 Oct 2001, Duncan Murdoch wrote:

> On Thu, 4 Oct 2001 18:14:48 +0200, Kurt Hornik wrote in message
> <15292.35576.513722.492732@mithrandir.hornik.net>:
> >Agreed.  As Peter said, subscripting by NA should give NA but R cannot
> >distinguish a string NA from the string NA.
> But it does make some sort of distinction, as my example contrasting
> "NA" with paste(NA) shows.  In case you missed it:
>  > is.na("NA")
>  [1] TRUE
>  > paste(NA)
>  [1] "NA"
>  > is.na(paste(NA))
>  [1] FALSE

Yes.  is.na() of a string is true if that string is actually a reference
to R_NaString.  Parsing a literal "NA" will give R_NaString, as will
coercing NA from some other type.  However, paste() doesn't check whether
it produces "NA". Neither does toupper()
  > is.na(toupper("na"))
  [1] FALSE
  > toupper("na")
  [1] "NA"

So we're partway there already, in fact.  It looks like we basically
need to
1) stop the parser generating R_NaString from \"NA\"
2) Change PRINTNAME(R_NaString) to avoid ambiguity


r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch