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

Dirk Eddelbuettel edd at debian.org
Sun Nov 11 06:39:02 CET 2012

On 10 November 2012 at 19:22, Ian Fellows wrote:
| 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. 

We think we are about to release a new version. It will, among other things,
bring a few new exciting things to Modules (as Romain already hinted on his
blog earlier in the week).

So maybe we should take this one question at a time.

| 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 ...
| Error in value[[3L]](cond) : failed to load module ernm from package ernm
| could not find function "getClass"

Quick guess:  Maybe force load / import of package 'methods' ?

More on the other questions in a few days. Let's take them one by one.


| 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
| ----------------------------------------------------------------------
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com  

More information about the Rcpp-devel mailing list