[Rcpp-devel] rcpp sugar elementary question
Bharath Govindarajan
bharath.quant at gmail.com
Tue Feb 19 16:49:43 CET 2013
Hi ,
I am trying a simple example to assign entire rows to a
Rcpp::NumericMatrix. I read the Rcpp sugar document and looked at a few
online
examples. My simple code below produces errors:
#include <iostream>
#include <Rcpp.h>
using std::cout;
using std:endl;
// [[Rcpp::export]
void test()
{
Rcpp::NumericMatrux mat(100,100);
int rows = mat.nrow();
int cols = mat.ncol();
cout << "rows " << rows << endl;
cout << "cols " << cols << endl;
Rcpp::NumericVector row2 = mat(1,_);
cout << "mat(1,_) " << row2 << endl;
}
Error: error: '_' was not declared in this scope
Thank you
Bharath
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130219/47b96116/attachment.html>
More information about the Rcpp-devel
mailing list