[Rcpp-commits] r1308 - in pkg/RcppExamples: inst src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue May 25 09:52:47 CEST 2010


Author: romain
Date: 2010-05-25 09:52:47 +0200 (Tue, 25 May 2010)
New Revision: 1308

Modified:
   pkg/RcppExamples/inst/ChangeLog
   pkg/RcppExamples/src/RcppMatrixExample.cpp
   pkg/RcppExamples/src/RcppStringVectorExample.cpp
   pkg/RcppExamples/src/RcppVectorExample.cpp
Log:
use List::create instead of Pairlist

Modified: pkg/RcppExamples/inst/ChangeLog
===================================================================
--- pkg/RcppExamples/inst/ChangeLog	2010-05-25 07:49:20 UTC (rev 1307)
+++ pkg/RcppExamples/inst/ChangeLog	2010-05-25 07:52:47 UTC (rev 1308)
@@ -1,6 +1,7 @@
 2010-05-25  Romain Francois <romain at r-enthusiasts.com
 
-	* src/*.cpp: use BEGIN_RCPP/END_RCPP in new api examples
+	* src/*.cpp: use BEGIN_RCPP/END_RCPP in new api examples and use List::create
+	instead of Pairlist
 
 2010-03-10  Dirk Eddelbuettel  <edd at debian.org>
 

Modified: pkg/RcppExamples/src/RcppMatrixExample.cpp
===================================================================
--- pkg/RcppExamples/src/RcppMatrixExample.cpp	2010-05-25 07:49:20 UTC (rev 1307)
+++ pkg/RcppExamples/src/RcppMatrixExample.cpp	2010-05-25 07:52:47 UTC (rev 1308)
@@ -36,10 +36,11 @@
     // so we use a STL transform() algorithm on each element
     std::transform(orig.begin(), orig.end(), mat.begin(), sqrt);
 
-    Rcpp::Pairlist res(Rcpp::Named( "result", mat),
-                       Rcpp::Named( "original", orig));
+    return Rcpp::List::create( 
+    	Rcpp::Named( "result" ) = mat, 
+    	Rcpp::Named( "original" ) = orig
+    	) ;
 
-    return res;
 END_RCPP
 }
 

Modified: pkg/RcppExamples/src/RcppStringVectorExample.cpp
===================================================================
--- pkg/RcppExamples/src/RcppStringVectorExample.cpp	2010-05-25 07:49:20 UTC (rev 1307)
+++ pkg/RcppExamples/src/RcppStringVectorExample.cpp	2010-05-25 07:52:47 UTC (rev 1308)
@@ -32,12 +32,11 @@
     std::transform( orig.begin(), orig.end(), vec.begin(), 
     	Rcpp::make_string_transformer(tolower) ) ;
 
-    Rcpp::Pairlist res(
+    return Rcpp::List::create(
     	Rcpp::Named( "result" )   = vec,
-    	Rcpp::Named( "original" ) = orig ) ;
+    	Rcpp::Named( "original" ) = orig 
+    	) ;
 
-    return res;
-
 END_RCPP
 }
 

Modified: pkg/RcppExamples/src/RcppVectorExample.cpp
===================================================================
--- pkg/RcppExamples/src/RcppVectorExample.cpp	2010-05-25 07:49:20 UTC (rev 1307)
+++ pkg/RcppExamples/src/RcppVectorExample.cpp	2010-05-25 07:52:47 UTC (rev 1308)
@@ -36,11 +36,11 @@
     // so we use a STL transform() algorithm on each element
     std::transform(orig.begin(), orig.end(), vec.begin(), sqrt);
 
-    Rcpp::Pairlist res(Rcpp::Named( "result", vec),
-                       Rcpp::Named( "original", orig));
+    return Rcpp::List::create( 
+    	Rcpp::Named( "result" ) = vec, 
+    	Rcpp::Named( "original" ) = orig
+    	) ;
 
-    return res;
-
 END_RCPP
 }
 



More information about the Rcpp-commits mailing list