[Rd] [Q] Package NS Hook Lint NOTE

Roebuck,Paul L proebuck at mdanderson.org
Wed Sep 14 19:53:39 CEST 2011

Have a question about the following NOTEs appearing on CRAN checks:

> .onLoad calls:
> require(methods)
> Package startup functions should not change the search path.
> See section ŒGood practice¹ in ?.onAttach.

For years, I have had the following in my S4-requiring packages.

.onLoad <- function(libname, pkgname) {
    ## In case namespace is loaded (via import) by package that
    ## doesn't depend on S4 methods and used in a session with
    ## non-default set of packages

It was all based on an explanation Prof. Ripley gave to someone
about some package loading corner case (reference lost to history
though circa R-2.7 or before). Is it no longer an issue?

More information about the R-devel mailing list