[R-pkg-devel] Using another package's method that isn't exported
georgi.boshnakov at manchester.ac.uk
Fri Nov 10 12:54:16 CET 2017
Presumably, you have imported 'confint' from 'stats'.
Just import something from MASS, e.g 'ginv':
or choose something else by studying the output of ls(asNamespace("MASS")).
Similarly import something from xml2.
Note that "IMPORTS" in DESCRIPTION ensures that the packages listed there are loaded.
Imports in NAMESPACE specify the functions and other objects that the functions in your package
will 'see' without '::' qualifiers. For generics, your package needs only to 'see' the generics, so it is sufficient to import the relevant generics ('confint' in your case). You don't need to import methods, unless you explicitly call them. It doesn't matter if the functions implementing them are exported or not. (Actually, there are further nuances in the terminology here - an S3 method is 'registered' if the generic knows about it. The function implementing it may or may not have been exported).
The message you got is a quality control message potentially letting you know that you don't need a package you have declared.
From: R-package-devel [mailto:r-package-devel-bounces at r-project.org] On Behalf Of Stuart Lacy
Sent: 10 November 2017 09:42
To: r-package-devel at r-project.org
Subject: [R-pkg-devel] Using another package's method that isn't exported
Yesterday I released the initial submission of my package 'epitab' to CRAN https://cran.r-project.org/web/packages/epitab/index.html. On my PC and on win_builder it passed CMD CHECK without any notes, warnings, or submissions. However, the built version has a note on some architectures, that I have some namespaces in Imports in my DESCRIPTION that are not actually imported from.
This is because my code uses the confint.glm method from MASS, so I add MASS to my Imports. However, the actual confint.glm method is not an exported function from MASS, and so in the code I never actually run MASS::confint.glm(mod), I just run the generic stats::confint(mod) on a glm object. I understand that to fix this note I need to explicitly use the imported MASS package, but I can't see how if I can't manually call the function that I'm using.
The other package that I've Imported without explicitly using is `xml2`, as win-builder threw up an error with "undefined exports" for various xml functions, that adding xml2 to the Imports fixed.
https://win-builder.r-project.org/G6RKiYtBQqaH/00check.log I didn't have any issue with xml2 on Linux.
Epidemiology and Cancer Statistics Group University of York
R-package-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
More information about the R-package-devel