[Rcpp-devel] How do instantiate an Rccpp and/or Armadillo object and then set it's underlying SEXP later?

Slava Razbash slava.razbash at gmail.com
Tue Oct 25 15:02:34 CEST 2011


Hello,

I will illustrate the idea of what I want to do with an example that
just uses an integer. So for example:

int myNumber;
nyNumber = 5;

So can I do something with Rcpp and SEXP objects as below. I know that
my code will be wrong but I am trying to convey an idea, so think of
it a pseudocode.
Pseudocode "example":

SEXP myFunction(SEXP myVector_s ) {
   Rcpp::NumericVector myVector;
   Rcpp::NumericVector myVector::as(myVector_s);

}


Further, will the following work with RcppArmadillo?

SEXP myFunction(SEXP myVector_s ) {
   arma::rowvec myVector;
   myVector = Rcpp::as<arma::rowvec>(myVector_s);

}


Thanks,

Slava


More information about the Rcpp-devel mailing list