[Rd] Setting NA from C code

Duncan Murdoch murdoch@stats.uwo.ca
Mon, 05 Nov 2001 09:28:15 -0500


In the maps library, NA's are inserted between polygons so lines() can
be used to draw all polygons at once.  The code to do it is like this:

            *x++ = NA_REAL;
            *y++ = NA_REAL;

where x and y are declared as 

	double *x, *y, *range;

and are the arguments passed in through a .C call.

However, the values show up in R as -6.62314033633867e-229 instead of
NA, so the drawing gets messed up.

Any suggestions as to what might be going wrong?

This is happening in Windows, using gcc 2.95.2, R source 1.3.1,
platform i386-pc-mingw32.

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