From tlumley@u.washington.edu  Thu Oct  4 19:31:52 2001
From: tlumley@u.washington.edu (Thomas Lumley)
Date: Thu, 4 Oct 2001 11:31:52 -0700 (PDT)
Subject: [Rd] Re: [R] Several R vs S-Plus issues
In-Reply-To: <el6prt4klee803l7vd32d922apud7rn3si@4ax.com>
Message-ID: <Pine.A41.4.33.0110041124310.100374-100000@homer38.u.washington.edu>

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

	-thomas

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


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