as.name() is not idempotent (PR#337)

Kurt Hornik Kurt.Hornik@ci.tuwien.ac.at
Wed, 24 Nov 1999 08:19:16 +0100 (CET)


>>>>> maechler  writes:

>  as.name(as.name("ss"))

> gives an error in R (0.90 and earlier)
> but should of course give the same as simply

>  as.name("ss") 

> This reminds me of similar bug/problem... which I don't recall.

> Yes, I should build tests like these into  "make test-Specific" ..

But not before fixing it, hopefully :-)

>From a brief glance at the code in coerce.c:

SEXP coerceVector(SEXP v, SEXPTYPE type)
{
    SEXP ans = R_NilValue;      /* -Wall */
    if (TYPEOF(v) == type)
        return v;

    switch (TYPEOF(v)) {
#ifdef NOTYET
    case NILSXP:
        ans = coerceNull(v, type);
        break;
    case SYMSXP:
        ans = coerceSymbol(v, type);
        break;
#endif

So you simply need to write coerceSymbol() and move the #ifdef.

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