[Rcpp-devel] inline and namespace loading issues for new package

Ian Fellows ian.fellows at stat.ucla.edu
Sun Nov 11 04:22:23 CET 2012


Hi All,

I've been working on an Rcpp based package (for the better part of a year and a half now), and have a few issues that I was hoping I could get some help with.

As a bit of background, this package fits (via MCMC-MLE) exponential family random graph models (ergm), markov random field models, and a new generalization of the two (un-creatively titled) exponential random network models (ernm). More full info on the math is available at [1], and some obtuse notes toward a vignette are at [2]. You can download the package source from [3].

The package uses Rcpp modules extensively to pass large C++ objects up and down between R and C++ transparently, and with no deep copies. 

Problem 1: on R CMD check I get a namespace loading warning. I believe this was discussed on list some time ago, but there wasn't a resolution offered that I could see. I tried adding imports(methods) to the namespace, to no avail. The warning is:

** checking whether the namespace can be loaded with stated dependencies ... WARNING
Error in value[[3L]](cond) : failed to load module ernm from package ernm
could not find function "getClass"
Error: .onLoad failed in loadNamespace() for ‘ernm’, details:
  call: fun(libname, pkgname)
  error: could not find function "initErnmStatistics"
Execution halted

Problem 2: I want to make the package extensible so that other packages can extend the C++ classes, and so that they can be used via inline. I tried to make an inline plug-in (see: inline.R), but have gotten stuck. Any guidance here is appreciated.

Problem 3: This isn't an Rcpp question per se, but… I have some C++ tests in a subdirectory of src (src/tests), I would like to export them to R so that they can be run on R CMD check but R doesn't seem to be compiling them correctly. How do I modify MakeVars to compile the subdirectory?

Any comments on the code itself are also more than welcome. It is still very much research code, so I'm sure that there are many ways to break it.

Best,
Ian



[1] http://fellstat.com/files/ifellows.pdf
[2] http://fellstat.com/files/ernm.pdf
[3] http://fellstat.com/files/ernm_1.0.tar.gz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20121110/7a797f8c/attachment.html>


More information about the Rcpp-devel mailing list