[Rcpp-commits] r1576 - pkg/Rcpp/inst/unitTests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jun 17 19:34:46 CEST 2010


Author: romain
Date: 2010-06-17 19:34:46 +0200 (Thu, 17 Jun 2010)
New Revision: 1576

Modified:
   pkg/Rcpp/inst/unitTests/runit.sugar.isna.R
Log:
any(is_na(.)) in C++ mimics any(is.na(.)) in R

Modified: pkg/Rcpp/inst/unitTests/runit.sugar.isna.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.sugar.isna.R	2010-06-17 17:32:41 UTC (rev 1575)
+++ pkg/Rcpp/inst/unitTests/runit.sugar.isna.R	2010-06-17 17:34:46 UTC (rev 1576)
@@ -37,3 +37,13 @@
 	checkEquals( fx( c(1:5,NA,7:10) ) , rep(FALSE,10) )
 }
 
+test.sugar.any.isna <- function( ){
+
+	fx <- cxxfunction( signature( x = "numeric" ), '
+		NumericVector xx(x) ;
+		return any( is_na( xx ) ) ;
+	', plugin = "Rcpp" )
+	
+	checkEquals( fx( c(1:5,NA,7:10) ) , TRUE )
+}
+



More information about the Rcpp-commits mailing list