[Rcpp-devel] Manipulation of IntegerVector

2014-07-11 Thread Mario Deng
Hello everyone, I still struggle with Rcpp, I hope you guys are patient. The problem occurs here: IntegerVector matched = match(sorted_vec, one_col); for(int j = 0; j < (matched.size() - 1); j++){ if( matched[j] >= matched[j+1] ){ matched[j+1] = matched[j]+1; } } I can access

[Rcpp-devel] Rcpp function variable which is given as argument

2014-07-09 Thread Mario Deng
Hello everyone, I am observing a, to me, strange behaviour. Rcpp seems to modify my variable, which is given as argument. Here is my code: In R am am running: Rcpp::sourceCpp("~/.../VectorList/VectorList.cpp") foo=matrix(runif(52), ncol=4) colnames(foo)=paste("X",1:ncol(foo),sep="") rownames(fo

Re: [Rcpp-devel] Trailing Index issues, handled as pointer

2014-07-07 Thread Mario Deng
1-indexed, but by passing an element of this vector > (match_id) to rownames[] you're treating it as if it's 0-indexed. > > -John > > > > > > On Mon, Jul 7, 2014 at 10:33 AM, Mario Deng wrote: > Hello everyone, > > I am trying to implement a da

[Rcpp-devel] Trailing Index issues, handled as pointer

2014-07-07 Thread Mario Deng
Hello everyone, I am trying to implement a data structure using Rcpp. But I am already struggling with my first method. How things (should) work: I want to my function ("createVectorList") a data frame or matrix. Each column of the matrix gets sorted. This also holds for the rownames - storing