Re: [Rcpp-devel] How to use functions from a R library in .cpp file

2015-01-23 Thread Li Li
Dear Yixuan, Thank you very much. I embedded the following into the program and it worked. The only thing changed was that I added "Rcpp::” so it could read in a cpp file. Rcpp::NumericVector test() { Rcpp::Environment pkg("package:mvtnorm"); Rcpp::Function pmvnorm = pkg["pmvnorm"];

Re: [Rcpp-devel] How to use functions from a R library in .cpp file

2015-01-22 Thread Yixuan Qiu
Hello, There is an example showing the usage of Environment and Function in the Rcpp Quick Reference Guide that is distributed with the package. For your problem, it's something as follows: NumericVector test() { Environment pkg("package:mnormt"); Function pmnorm = pkg["pmnorm"]; Numer

[Rcpp-devel] How to use functions from a R library in .cpp file

2015-01-22 Thread Li Li
Hi, I am trying to use the function "pmnorm" from R package "mnormt" in a .cpp file. I was wondering if anyone could help me with the following code so that I can use "pmnorm" somewhere in my sample function "epsilonij". #include // [[Rcpp::depends(RcppArmadillo)]] using namespace arma; //