[R] Using as.integer(NA) in the .C function
cgenolin
cgenolin at u-paris10.fr
Tue May 7 15:30:59 CEST 2013
Hi the list,
I am including some C code in a R program using the .C interface. I want to
deal with NA values, but the result is strange:
--- 8< ------------ C code -----------
void hein(int *a, int *b, int* c){
*c = (*a + *b);
}
--- 8< -----------------------------------
--- 8< ------------- R code -----------
> .C("hein",as.integer(NA),as.integer(1),as.integer(1),NAOK=TRUE)[[3]]
[1] -2147483647
--- 8< ---------------------------------
The result should be NA, isn't it? What wrong il my code?
Christophe
--
View this message in context: http://r.789695.n4.nabble.com/Using-as-integer-NA-in-the-C-function-tp4666470.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list