<div dir="ltr"><div>Hi Dear</div><div><br></div><div>I want to use dmvnorm() function into an cpp function using RcppArmadillo I am trying to execute the following function. It gives me error <br></div><div><br></div><div>cannot convert 'SEXP' to 'double' in assignment</div><div><br></div><div>Could you please guide where I am wrong?</div><div><br></div><div>#include <RcppArmadillo.h><br>using namespace Rcpp;<br>using namespace RcppArmadillo;<br>using namespace arma;<br><br>//[[Rcpp::depends(RcppArmadillo)]]<br>//[[Rcpp::export]]<br><br>arma::rowvec  dmvnormC(const arma::mat& x, const arma::vec& mean, const arma::mat& sigma, int give_log)<br>{<br> Environment pkg = Environment::namespace_env("mvtnorm");<br> Function dmvnorm = pkg["mvtnorm"];<br> int N = x.n_rows;<br> arma::rowvec f(N, fill::zeros);<br> for(int k=0; k<N; k++)<br>  {<br>   f(k) = dmvnorm(x.row(k), mean,  sigma, give_log);<br>  }<br> return f;<br>}</div><div><br></div><div>Thank you</div><div><br></div><div>Shaami<br></div></div>