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"];
NumericVector x = NumericVector::create(1, 0, 1);
NumericVector mean = NumericVector::create(0, 0, 0);
NumericMatrix cov(3, 3);
cov(0, 0) = cov(1, 1) = cov(2, 2) = 1;
return pmnorm(x, mean, cov);
}
Best,
Yixuan
2015-01-22 19:29 GMT-05:00 Li Li <[email protected]>:
> 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 <RcppArmadillo.h>
> // [[Rcpp::depends(RcppArmadillo)]]
> using namespace arma;
>
> // [[Rcpp::export]]
>
> double epsilonij (double nu_i_lj, Rcpp::NumericVector w, ){
> ....
> }
>
>
> Thanks.
>
>
> Li
>
> _______________________________________________
> Rcpp-devel mailing list
> [email protected]
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
>
--
Yixuan Qiu <[email protected]>
Department of Statistics,
Purdue University
_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel