Is there a way to pass a data.table
objects to c++ functions using Rcpp
and/or RcppArmadillo
without manually transforming to data.table
to a data.frame
? In the example below test_rcpp(X2)
and test_arma(X2)
both fail with c++ exception (unknown reason)
.
R code
X=data.frame(c(1:100),c(1:100))
X2=data.table(X)
test_rcpp(X)
test_rcpp(X2)
test_arma(X)
test_arma(X2)
c++ functions
NumericMatrix test_rcpp(NumericMatrix X) {
return(X);
}
mat test_arma(mat X) {
return(X);
}