[Rcpp-devel] Rcpp::Function

Romain François francoisromain at free.fr
Mon Jan 4 23:59:04 CET 2010


Just to give an example of Rcpp::Function :

 > funx <- cfunction(signature(), '
+ Environment stats_namespace = Environment::namespace_env("stats") ;
+ Function rnorm( stats_namespace.get("rnorm") ) ;
+ return rnorm( 10, Named("sd", 100) ) ;
+ ', Rcpp=TRUE, verbose=FALSE, includes = "using namespace Rcpp;" )
 >
 > funx()
  [1]   19.4633261 -121.6885863   34.7072963   -7.1155573  -33.4987573
  [6]  -73.0344024  -58.9558195   -0.3289519   81.7164016  151.8835010


One thing we are going to have to do at some point is some examples 
somewhere. We have lots of unit tests, but maybe it would be worth 
having some C++ only examples (without the inline trick) to show the API.

Romain

-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/IW9B : C++ exceptions at the R level
|- http://tr.im/IlMh : CPP package: exposing C++ objects
`- http://tr.im/HlX9 : new package : bibtex



More information about the Rcpp-devel mailing list