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

Dirk Eddelbuettel edd at debian.org
Sun Nov 11 13:12:30 CET 2012


On 10 November 2012 at 23:34, Ian Fellows wrote:
| Dirk,
| 
| > 
| > 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.
| 
| 
| I had already added methods to the namespace via import in the NAMESPACE file, and added it to the depends in the DESCRIPTION file. I just tried adding an explicit library(methods) to .onLoad, which fixed the warning, but now gives me:

Ok, sorry.
 
| * checking R code for possible problems ... NOTE
| File ‘ernm/R/zzz.R’:
|   .onLoad calls:
|     library(methods)
| 
| Package startup functions should not change the search path.
| See section ‘Good practice’ in ?.onAttach.

Modules no longer need to be loaded via .onLoad.  Here is eg what the little
RcppCNPy (which I wrote over the summer) does:

   edd at max:~$ cat svn/rcpp/pkg/RcppCNPy/R/*

   loadModule("cnpy", TRUE)


   edd at max:~$ 

That is the _entire_ R/ directory -- one line. This example is a little
extreme, of course, but as far as loading goes... all you need is
loadModule() and the second argument even defaults to TRUE as I recall.
The package is on CRAN if you want to take a quick peek.

I'm off for a run now and soccer game of daughter #1 later but will be back
home most of the (Central time) afternoon so maybe we can try a few things
off-list.    

Your feedback in making the "Rcpp modules" vignette better is appreciated.

Dirk
 
| Best,
| ian
-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com  


More information about the Rcpp-devel mailing list