[Rcpp-devel] Using Rcpp in C++
SILKWODJ at airproducts.com
Sat Jun 11 14:59:28 CEST 2011
You obviously want to get stated. I have to assume that you use R,
because you would not have found Rcpp any other way.
Rcpp is a means of writing functions in C++ that R can call. So you
don't expect to compile a stand-alone program with main().
The easiest way to experience Rcpp is using inline code, we need to have
the package "inline" installed so we can reference its library.
Here is an R script that will do a little more than you wished.
src <- '
output=runif( num_rands,0, 1 ) ;
test_function <- cxxfunction(signature(arg1 = "integer"), src, plugin =
This script will create a function in your R session called
test_function. You will not see it in the object list, but it is there.
It takes a single integer argument.
So after running the script above in the R Console you can then call the
function like this:
in the R Console.
Soeren Vogel wrote:
Hello I want to experiment a little with Rcpp, however, as a newby I
don't get it to work, e.g.:
using namespace Rcpp;
std::cout << runif( 1, 0, 1) << std::endl;
How can I get it to work? Thanks, S?ren
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Rcpp-devel