[R] How to avoid test for NAs in foreign function call

Tony Plate tplate at acm.org
Thu Dec 14 17:16:57 CET 2006


Supply NAOK=TRUE argument to .C; the help page for .C() contains the 
following:

Usage
                 .C(name, ..., NAOK = FALSE, DUP = TRUE, PACKAGE)

Also, you might want to consider using the "raw" data type instead of 
integers -- that way you should have fewer problems with R code making 
unwanted interpretations of certain bit patterns.

-- Tony Plate

Knut M. Wittkowski wrote:
> We have packed logical vectors into integers, 32 flags at a time and 
> then want to AND or OR these vectors of "integers" using other C functions.
> 
> The problem: occasionally, the packed sequence of 32 logical values 
> resembles NA, causing the error message:
> 
> Error in bitAND(packed1, packed2, lenx) :
>          NAs in foreign function call (arg 1)
> 
> How does one instruct R to avoid checking for NAs?
> 
> Knut M. Wittkowski, PhD,DSc
> ------------------------------------------
> The Rockefeller University,
> Center for Clinical and Translational Science
> Research Design and Biostatistics,
> 1230 York Ave #121B, Box 322, NY,NY 10021
> +1(212)327-7175, +1(212)327-8450 (Fax), kmw at rockefeller.edu
> http://www.rockefeller.edu/ccts/rdbs.php
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list