[R] NA in C/C++

cstrato@EUnet.at cstrato at EUnet.at
Sun May 28 20:12:21 CEST 2000


Dear Prof Ripley

Thank you very much for your fast response. I did not realize that meanwhile
CRAN has official documents.

Section 3.7.3 mentions macros in "Arith.h" for handling NAs.
I assume that these macros can also be used in normal C programs.

>From your answer I assume that C-libraries like the  STL-library are normally

not able to deal with NAs?

Best regards
Christian Stratowa


Prof Brian D Ripley wrote:

> 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