[Rd] 'R CMD check' and S4 methods

Yohan Chalabi chalabi at phys.ethz.ch
Tue Jul 29 15:31:17 CEST 2008

Dear all,

I was looking for a function to analyze the code of a package and I
went throught the function 'checkUsagePackage' of package:codetools
which is used in 'R CMD check' script.

As far as I understand it, 'checkUsagePackage' does not check the code
usage of  S4 methods because it loads all function names from a given
environment where only the name of the generic function is given for S4

for example

setClass("foo", representation(x= "character"))
foo <- new("foo", x = "dummy")
setMethod("show", "foo", function(object) noVisibleGlobalFunction())
print.foo <- function(x, ...) noVisibleGlobalFunction()
## checkUsageEnv detects the problem in print.foo but not with the
## defined method
## or

One can repeat this exmaple with 'checkUsagePackage'.

Is it right that code usage of S4 methods is not checked with
'R CMD check'?

thanks in advance for your response,

More information about the R-devel mailing list