[R] NA in C/C++

Prof Brian D Ripley ripley at stats.ox.ac.uk
Sun May 28 17:43:46 CEST 2000


On Sun, 28 May 2000 cstrato at EUnet.at wrote:

> Dear R-people
> 
> Sorry for asking a question only indirectly related to S/R but since
> data containing NA values
> can so easily be handled in S/R, and you can write functions for S/R in
> C, my question is:
> How do you handle data containing NA in C/C++ ?
> 
> Although I know that IEEE floating point arithmetics supports NaN and
> Inf, I cannot find
> any information about this (e.g. in any of my many C++ books)
> 
> Thank you in advance for your help
> Christian Stratowa, Vienna

It's in Writing R Extensions (sections 3.7.3 and 4.4 in the copy I have to
hand, but it's in the concept index). You cannot assume in R that NA is
represented by an NaN, although on most machines it is.  Conversely, most
NaNs are not NA.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

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



More information about the R-help mailing list