Martin Spindler
2014-Sep-30 11:00 UTC
[Rd] Package Rcpp: Question conerning source code of cpp files and related question
Dear all, I am trying to use Rcpp to write some files in C++ for use in R. Below is an example for a cpp-file (crossp.cpp). Then I use >sourceCpp("crossp.cpp") in R and the corresponding function is availabe in R. Now I have to question related to this worklfow: 1) Is there a way to see the source file of the "final" cpp-file? (I mean is it possible to see how the //-lines are replaced and what soureCpp does?) 2) (Connected with the first question) Up to now, I am working in R Studio, but I would prefer an IDE (e.g. NetBeans IDE). But when I compile the cpp-file there, the following message shows up: In file included from /R/win-library/3.0/RcppArmadillo/include/RcppArmadilloForward.h:28:0, from /R/win-library/3.0/RcppArmadillo/include/RcppArmadillo.h:30, from crossp.cpp:1: /R/win-library/3.0/RcppArmadillo/include/RcppArmadilloConfig.h:90:35: fatal error: RcppArmadilloLapack.h: No such file or directory #include <RcppArmadilloLapack.h> Is there an way to compile the file without sourCpp but in an IDE? What do I have to change? As I am starting to work with Rcpp my question might sound silly, but any help and comments are highly welcome. Thank you very much for your help in advance! Best, Martin crossp.cpp: #include <RcppArmadillo.h> // [[Rcpp::depends(RcppArmadillo)]] using namespace Rcpp; using namespace arma; //[[Rcpp::export]] NumericMatrix crossp3(NumericMatrix Xr) { int n = Xr.nrow(), k = Xr.ncol(); arma::mat X(Xr.begin(), n, k, false); arma::mat XXt = X.t()*X; return Rcpp::wrap(XXt); } [[alternative HTML version deleted]]
Dirk Eddelbuettel
2014-Sep-30 11:38 UTC
[Rd] Package Rcpp: Question conerning source code of cpp files and related question
On 30 September 2014 at 13:00, Martin Spindler wrote: | I am trying to use Rcpp to write some files in C++ for use in R. Please subscribe to rcpp-devel, and post on that list. Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org