R-alpha: (minor?) S-R inconsistency: NULL =~= list() -- useful is.ALL function
Thomas Lumley
Thomas Lumley <thomas@biostat.washington.edu>
Fri, 15 Aug 1997 08:53:11 -0700 (PDT)
On Fri, 15 Aug 1997, Martin Maechler wrote:
> In S,
> NULL
> and
> list()
> are not the same.
>
> In R they are (I think).
>
The thing that really broke your code is an incompatibility I reported a
while back that people didn't seem to think was serious.
Comparisons involving NULL give an error in R, but give NA in S. I didn't
have an example at the time except to point out that returning NA would at
least allow correct short-circuiting of & and | conditions.
I think in match() there is a much stronger argument for returning NA (or
the nomatch value). After all, the description of match says
If x[i] is found to equal table[j] then the value
returned in the i-th position of the return value is j.
If no match is found, the value is nomatch.
Surely if table==NULL then the correct return value is nomatch.
Thomas Lumley
------------------------------------------------------+------
Biostatistics : "Never attribute to malice what :
Uni of Washington : can be adequately explained by :
Box 357232 : incompetence" - Hanlon's Razor :
Seattle WA 98195-7232 : :
------------------------------------------------------------
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-