<div dir="ltr">I am trying to figure out how to create a package where I have one function call another, which returns a list.  Some example .cpp code is below.  If I just compile the first function, everything is fine.  When I add the second function, I get errors.  I'm sure I'm using the Rcpp::List syntax incorrectly, but I haven't had luck finding an example of how to do this.<div>
<br></div><div>Again, I'd like to be able to call the first function from the second, grab the results from the returned list, and do further computations.</div><div><br></div><div>Thanks, Scott<div><div><br></div><div>
<br></div><div><div>#include <RcppArmadillo.h></div><div>using namespace Rcpp ;</div><div>// [[Rcpp::depends(RcppArmadillo)]]</div><div><br></div><div>// [[Rcpp::export]]</div><div>List check_C(NumericMatrix B) {</div>
<div>  arma::mat A = Rcpp::as<arma::mat>(B);</div><div>  int p = A.n_cols;</div><div>  arma::mat AA = A*A;</div><div>  arma::vec X = A.col(0);</div><div><br></div><div>  return Rcpp::List::create(Rcpp::Named("X")=X, Rcpp::Named("AA")=A, Rcpp::Named("p")=p);</div>
<div>}</div><div><br></div><div>// [[Rcpp::export]]</div><div>List check_C(NumericMatrix A) {</div><div>  Rcpp::List L = check_C(A);</div><div><br></div><div>  return Rcpp::List::create(Rcpp::Named("A")=A);</div>
<div>}</div></div><div><br></div><div><br></div><div><br></div></div></div></div>