[R] Rcpp module / class access -- answer

Pascal A. Niklaus Pascal.Niklaus at ieu.uzh.ch
Tue Mar 3 16:35:47 CET 2015

Hi all,

I am trying to answer my own question (although it probably does not end 
up in the thread because I am not a subscribed and thus have to send a 
new mail).

The way I finally got the code working was:

In NAMESPACE, comment out the following lines

# importFrom(Rcpp, loadModule)
# importFrom(Rcpp, evalCpp)

In zzz.R:

# loadModule("mod_yada",TRUE);

.pkgNamespace <- environment()

.onLoad <- function(libname, pkgname) {

The object generation then works as expected in the S4 class code.

Not sure whether this is the best way to achieve this, though.


More information about the R-help mailing list