[Rcpp-devel] Segfaults when declaring Vector types
Patrick Ye
ye.patrick at gmail.com
Thu Apr 14 15:20:31 CEST 2011
Hi Dirk,
Thanks so much for the reply, I really appreciate it.
I thought that I was misusing Rcpp, as all the examples I found seemed
to be for writing C++ functions to be used in R -- not accessing R
functions in C++.
Thanks so much for your suggestions on RInside, I just found out about
it a few minutes ago myself, and my code is no longer segfaulting. :)
One more question if you don't mind. Where can I find documentation on
accessing the member variables of an R instance using Rcpp? Let me give
you a concrete example of what I need to do.
I'm trying to use the stl function in R to calculate the seasonal,
trend, remainder and weight parameters of a time series object. I've
gotten as far as creating the time series object from a list of numbers,
and then passing the time series to the stl function using a
Rcpp::Language object, and then grabbing the results using the eval()
function of the Rcpp::Language object. If it was in R, I could access
the weights using notations like "foo$weights", and the time series
object as "foo$time.series". If it was in rpy2, I could use the
dictionary notations to access the "weights" and "time.series" members
of stl's return value. However, I cannot seem to find any
function/notation in Rcpp that allows me to do the same thing.
I guess I could generate a string that represents all the things I need
to do in R, and use the parseEval function of the RInside object to get
the final results. However, that just doesn't seem to be very elegant.
Is there another way?
Thanks a lot!
Have a nice day!
Patrick
More information about the Rcpp-devel
mailing list