Worik, On Mon, Sep 12, 2011 at 10:54 PM, Worik R <wor...@gmail.com> wrote: > Friends > > I am looking at Rcpp and I am a bit stuck on a simple matter. > Rcpp questions will likely get more attention on the Rcpp-devel list: http://lists.r-forge.r-project.org/mailman/listinfo/rcpp-devel
> (I am calling R from c++, if there is a better way...) > > Given this simple example using the TTR package and the SMA function which > returns a simple moving average.... > > Rcpp::NumericVector rv; > for(int i = 0; i < 100; i++){ > rv.push_back(rand()); > } > Rcpp::Environment TTR("package:TTR"); > Rcpp::Function sma = TTR["SMA"]; > SEXP sma_res = sma(rv); > > How do I get the values of sma_res from a SEXP type into something > useful in C++, like a vector<float>? > > Where can I find some documentation of SEXP? I have tried googling it > to no avail. > See the R Internals manual: http://cran.r-project.org/doc/manuals/R-ints.html > cheers > Worik > Best, -- Joshua Ulrich | FOSS Trading: www.fosstrading.com ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.