[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
methods.
for example
library(codetools)
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
checkUsageEnv(.GlobalEnv)
## or
checkUsage(show)
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,
Yohan
More information about the R-devel
mailing list