I am trying to build a package in R involving the Rcpp
package. When I generated the package using the command Rcpp.package.skeleton("pck338")
.
By default, the files rcpp_hello_world.cpp
is included, and the RcppExports.cpp
file is included as well.
To my understanding, the compileAttributes()
function needs to be run every time a new .cpp
function is added to the src
directory.
To that end, I wrote a simple function in the rcpp_dance.cpp
file that goes like this:
# include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp:export]]
int rcpp_dance(int x) {
int val = x + 5;
return val;
}
However, when I run the compileAttributes()
, the RcppExports.cpp
stays the same, so the dance function is not converted to an R function. Why is this happening? Any specific and general feedback would be appreciated.