[Rcpp-devel] is_finite<STRSXP> corrections

Thomas Tse tommy_228_228 at yahoo.com.hk
Wed Oct 2 13:37:58 CEST 2013


Hi,

in R, is.finite() and is.infinite() always return FALSE for character():

> is.finite(c('abc', NA_character_, 'efg'))
[1] FALSE FALSE FALSE
> is.infinite(c('abc', NA_character_, 'efg'))
[1] FALSE FALSE FALSE

so, we may need to change the template is_finite<STRSXP> from:

template <>

inline bool is_finite<STRSXP>( SEXP x ){
    return x != NA_STRING ;
}



to:

template <>

inline bool is_finite<STRSXP>( SEXP x ){
    return false;

}


thanks,
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20131002/57d8f52d/attachment.html>


More information about the Rcpp-devel mailing list