Thanks a lot. That helped.

Regards
Bharath

On Tue, Feb 19, 2013 at 10:53 AM, Romain Francois
<[email protected]>wrote:

> _ is defined in the Rcpp namespace, so perhaps you want to add :
>
> using namespace Rcpp ;
>
> somewhere on top.
>
> Also, you could use mat.row(1) instead of mat(1,_)
>
> Romain
>
> Le 19/02/13 16:49, Bharath Govindarajan a écrit :
>
>  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
>>
>
>
> --
> Romain Francois
> Professional R Enthusiast
> +33(0) 6 28 91 30 30
>
> R Graph Gallery: 
> http://gallery.r-enthusiasts.**com<http://gallery.r-enthusiasts.com>
>
> blog:            
> http://romainfrancois.blog.**free.fr<http://romainfrancois.blog.free.fr>
> |- http://bit.ly/14LJhmm : bibtex 0.3-5
> `- http://bit.ly/RE6sYH  : OOP with Rcpp modules
>
> ______________________________**_________________
> Rcpp-devel mailing list
> [email protected]**project.org<[email protected]>
> https://lists.r-forge.r-**project.org/cgi-bin/mailman/**
> listinfo/rcpp-devel<https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel>
>
_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to