[Rcpp-devel] problem with sample() implemented in Rcpp/RcppArmadillo

2012-10-27 Thread Christian Gunning
> I am very new to c++ so I apologize in advance if this is a stupid question: I ran into this myself when I started using Rcpp -- it's a good question. The R API is extensive, but it's vanilla C and doesn't handle vectors (and you already know how to sample() a scalar, right?). > For a larger

Re: [Rcpp-devel] problem with sample() implemented in Rcpp/RcppArmadillo

2012-10-27 Thread Dirk Eddelbuettel
Rahel, Thanks for posting on the list. On 26 October 2012 at 19:08, Rahel Sollmann wrote: | Hi Rcpp folks; | I am very new to c++ so I apologize in advance if this is a stupid question: | For a larger analysis I am trying to implement the R function sample() in c++ | via RcppArmadillo. I want to

Re: [Rcpp-devel] problem with sample() implemented in Rcpp/RcppArmadillo

2012-10-27 Thread Dirk Eddelbuettel
On 27 October 2012 at 05:13, Christian Gunning wrote: | > I am very new to c++ so I apologize in advance if this is a stupid question: | | I ran into this myself when I started using Rcpp -- it's a good | question. The R API is extensive, but it's vanilla C and doesn't | handle vectors (and you

Re: [Rcpp-devel] problem with sample() implemented in Rcpp/RcppArmadillo

2012-10-27 Thread Rahel Sollmann
Thanks Christian and Dirk, I appreciate your help. I am using sample() because in my real application probabilities for the members of the vector I want to sample from are not equal. I'm happy and embarrassed to say that I figured out my problem. I should have provided a vector with values from