<div>Hello list,</div><div>I have several std::vector<double> in a STL container and would like to fill a Rcpp::NumericMatrix row by row with them, is there an easy way to do it, or should I iterate over all elements as in usual C++? </div>
<div>I saw the `_` in this post on SO but I think it has a different purpose.<br></div><div>cCode <- '<br> double v_value[] = {1.1,2.4};<br> vector<double> v(v_value, v_value + sizeof(v_value)/sizeof(double));<br>
NumericMatrix m(3,2);<br> </div><div> //Here is what I was hoping for<br> //for(int i=0; i<3; i++){<br> // m(i,_) = v;</div><div> //}<br> </div><div> return m;</div><div>';</div><div>R)</div>
<div>fillMat <- cxxfunction(signature(), includes='using namespace std;', plugin="Rcpp", body=cCode) </div><div> </div><div>Regards</div><div> </div>