[Rcpp-devel] Save lm, glm, polr class objects

Dirk Eddelbuettel edd at debian.org
Wed Apr 25 14:06:19 CEST 2012


Sorry for sending you a copy. I forgot to CC the list on the mail I just sent you.

On 25 April 2012 at 09:12, David Ibarra Gómez wrote:
| Hello,
|                 I'm a happy user of RInside: thanks for creating such a useful
| tools!
| I use RInside with C++ on a Debian machine sending data to R using Rinside,
| doing some stats and geting back results. Here http://dirk.eddelbuettel.com/
| code/rcpp.html I see: "R data types (SEXP) are matched to C++ objects in a
| class hierarchy. All R types are supported (vectors, functions, environment,
| etc ...) and each type is mapped to a dedicated class. For example, numeric
| vectors are represented as instances of the Rcpp::NumericVector class,
| environments are represented as instances of Rcpp::Environment, functions are
| represented as Rcpp::Function, etc ..."
| I would like to improve the things that I actually do with RInside.
| Specifically I would like after fitting a lm.fit (or glm.fit, polr.fit, ?) get
| this class to C++ from R, 

You can get any R Object converted to a C++ object for which there is an
implicit or explicit wrap() variant.

The easiest for richer R objects are transfer as a list() object to

You can then pick the list apart and get to the components.

| to be able to serialize it, save it in a database and
| being able to use it other day. 

You can serialize in R or in C++. In the latter case you may need to write
more C++ to do the serialization or ...
| In short, is it possible to? get a lm.fit from R to C++ using RInside and put
| this object back to R. Also some way to save it (serialize or something, I'm
| also using protobuf).

... maybe our RProtoBuf package may be of help with proper proto files.


R/Finance 2012 Conference on May 11 and 12, 2012 at UIC in Chicago, IL
See agenda, registration details and more at http://www.RinFinance.com

More information about the Rcpp-devel mailing list