Re: [Rd] Saving Rcpp Objects for Future Use

From: Dirk Eddelbuettel <edd_at_debian.org>
Date: Fri, 09 Sep 2011 17:52:00 -0500

Hola,

On 9 September 2011 at 16:07, Michael King wrote:
| Hello,
|
| I have recently been doing some research regarding how to successfully save
| and load Rcpp Objects ( objects from modules ) for future use, but with
| little success. For example, to use the example package (from package
| skeleton) in Rcpp:
|
| >library(Rcpp)
| >Rcpp.package.skeleton("rdevelhelp", module=TRUE)
| ...
| > q()
| // install rdevelhelp using R CMD INSTALL
| // load new R Session
|
| >library(rdevelhelp)
| >x <- new(World)
| >x$set("help me")
| >x$greet()
| "help me"
| >save(x, "x.RData")
| >q()
|
| // reload R
| >library(rdevelhelp)
| >load("x.RData")
| > ### here comes the problem...
| > x$greet()
| Error in .External(list(name = "CppMethod__invoke_notvoid", address =
| <pointer: 0x0>, :
| NULL value passed as symbol address
| >q()
|
| ################
|
| is there a best practice to solving this problem? I have read some posts
| about external pointers and have learned a little about serialization, but
| want to make sure I am approaching the problem correctly.

This has been discussed several times _on the list dedicated to Rcpp question_ ie rcpp-devel. You could try a search such as

    site:gmane.org rcpp-devel 'reload module'

to catch some of those.

But in short: the load / save cycle is simply not available for Rcpp modules objects.  

| Thanks for your help.

Pleasure. Hope to see you over at rcpp-devel. Subscribe before you try to post.

Dirk  

| -Mike
|
| [[alternative HTML version deleted]]
|
| ______________________________________________
| R-devel_at_r-project.org mailing list
| https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
Two new Rcpp master classes for R and C++ integration scheduled for 
New York (Sep 24) and San Francisco (Oct 8), more details are at
http://dirk.eddelbuettel.com/blog/2011/08/04#rcpp_classes_2011-09_and_2011-10
http://www.revolutionanalytics.com/products/training/public/rcpp-master-class.php

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Fri 09 Sep 2011 - 22:54:46 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 10 Sep 2011 - 08:30:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive