Thanks a lot. That helped.<div><br></div><div>Regards</div><div>Bharath<br><br><div class="gmail_quote">On Tue, Feb 19, 2013 at 10:53 AM, Romain Francois <span dir="ltr"><<a href="mailto:romain@r-enthusiasts.com" target="_blank">romain@r-enthusiasts.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">_ is defined in the Rcpp namespace, so perhaps you want to add :<br>
<br>
using namespace Rcpp ;<br>
<br>
somewhere on top.<br>
<br>
Also, you could use mat.row(1) instead of mat(1,_)<br>
<br>
Romain<br>
<br>
Le 19/02/13 16:49, Bharath Govindarajan a écrit :<div><div class="h5"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi ,<br>
<br>
I am trying a simple example to assign entire rows to a<br>
Rcpp::NumericMatrix. I read the Rcpp sugar document and looked at a few<br>
online<br>
examples. My simple code below produces errors:<br>
<br>
<br>
#include <iostream><br>
#include <Rcpp.h><br>
<br>
using std::cout;<br>
using std:endl;<br>
<br>
// [[Rcpp::export]<br>
<br>
void test()<br>
{<br>
Rcpp::NumericMatrux mat(100,100);<br>
int rows = mat.nrow();<br>
int cols = mat.ncol();<br>
cout << "rows " << rows << endl;<br>
cout << "cols " << cols << endl;<br>
Rcpp::NumericVector row2 = mat(1,_);<br>
cout << "mat(1,_) " << row2 << endl;<br>
<br>
<br>
<br>
}<br>
<br>
<br>
Error: error: '_' was not declared in this scope<br>
<br>
Thank you<br>
Bharath<br>
</blockquote>
<br>
<br></div></div>
-- <br>
Romain Francois<br>
Professional R Enthusiast<br>
<a href="tel:%2B33%280%29%206%2028%2091%2030%2030" value="+33628913030" target="_blank">+33(0) 6 28 91 30 30</a><br>
<br>
R Graph Gallery: <a href="http://gallery.r-enthusiasts.com" target="_blank">http://gallery.r-enthusiasts.<u></u>com</a><br>
<br>
blog: <a href="http://romainfrancois.blog.free.fr" target="_blank">http://romainfrancois.blog.<u></u>free.fr</a><br>
|- <a href="http://bit.ly/14LJhmm" target="_blank">http://bit.ly/14LJhmm</a> : bibtex 0.3-5<br>
`- <a href="http://bit.ly/RE6sYH" target="_blank">http://bit.ly/RE6sYH</a> : OOP with Rcpp modules<br>
<br>
______________________________<u></u>_________________<br>
Rcpp-devel mailing list<br>
<a href="mailto:Rcpp-devel@lists.r-forge.r-project.org" target="_blank">Rcpp-devel@lists.r-forge.r-<u></u>project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-<u></u>project.org/cgi-bin/mailman/<u></u>listinfo/rcpp-devel</a><br>
</blockquote></div><br></div>