Skip to content
Prev 5569 / 398513 Next

coercing NA to complex?

On Mon, May 08, 2000 at 10:22:11AM +1000, John Peters wrote:
Thanks for the bug report!  Access to cut-and-paste makes it all too
easy to avoid thinking about what you are doing.

I am committing a fix to the development tree, but if it is an urgent
problem for you, please replace the "default" case in the function
"ComplexAnswer" in src/main/bind.c with the following:

    default:
        n = LENGTH(x);
        for (i = 0; i < n; i++) {
            xi = INTEGER(x)[i];
            if (xi == NA_INTEGER) {
                COMPLEX(ans_ptr)[ans_length].r = NA_REAL;
                COMPLEX(ans_ptr)[ans_length].i = NA_REAL;
            }
            else {
                COMPLEX(ans_ptr)[ans_length].r = xi;
                COMPLEX(ans_ptr)[ans_length].i = 0.0;
            }
            ans_length++;
        }
        break;

Ross
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Message-ID: <20000508162224.A29401@stat1.stat.auckland.ac.nz>
In-Reply-To: <200005080022.KAA00945@dylan.tip.CSIRO.AU>; from John Peters on Mon, May 08, 2000 at 10:22:11AM +1000