[Rcpp-devel] is_na, is_infinite etc
Romain François
romain at r-enthusiasts.com
Thu Jan 23 01:08:39 CET 2014
This is not implemented as members of Vector.
See: https://github.com/RcppCore/Rcpp/blob/b5ff9b5530e4a82682caab5ddc87ac23a7b8857e/inst/include/Rcpp/traits/is_infinite.h
So, you can use:
traits::is_infinite<REALSXP>(x)
Romain
Le 23 janv. 2014 à 00:07, Søren Højsgaard <sorenh at math.aau.dk> a écrit :
> Dear all,
>
> I am struggeling with checking for NA and Inf in a loop over a numeric vector. I have created these two helpers:
>
> //[[Rcpp::export]]
> bool isna( double x){
> return NumericVector::is_na(x) ;
> }
>
> //[[Rcpp::export]]
> bool isinf( double x){
> return NumericVector::is_infinite(x) ;
> }
>
> isna works but compiling isinf gives:
>
> error: 'is_infinite' is not a member of 'Rcpp::NumericVector {aka Rcpp::Vector<14>}'
>
> From what I can read on the web, is_infinte IS implemented, so I can't spot what is wrong. Any insight?
>
> Cheers
> Søren
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
More information about the Rcpp-devel
mailing list