CRAN packages maintained by you

Martin Maechler maechler at stat.math.ethz.ch
Thu Apr 15 16:12:08 CEST 2010


>>>>> "YC" == Yohan Chalabi <chalabi at phys.ethz.ch>
>>>>>     on Thu, 15 Apr 2010 14:47:59 +0200 writes:

    >>>>> "MM" == Martin Maechler <maechler at stat.math.ethz.ch>
    >>>>> on Wed, 14 Apr 2010 18:57:35 +0200

    MM> ("summary" , "sparseMatrix") is indeed a method from the
    MM> Matrix package.
    MM> 
    MM> How exactly do you import Matrix (methods)?  Could it be that
    MM> you should
    MM> change something there, e.g. if you define "summary" methods
    MM> yourself?

    YC> Hi Martin,

    YC> fRegression does not import any method from Matrix pkg.

    YC> I could track down the problem to the call of .get_S4_methods_list
    YC> in undoc().

    YC> tools:::.get_S4_methods_list can return methods defined in other
    YC> package :


    library(fRegression)
    code_env <- as.environment(paste("package", "fRegression", sep = ":"))
    str(gml <-  tools:::.get_S4_methods_list("summary", code_env))

Hmm, and that returns a single method with "fREG" signature for
me (using R 2.11.0 rc).
What do you get ?


    YC> One option could be to update tools:::.get_S4_methods_list() with
    YC> something like :

> get_S4_methods_list <- function(g, env) {
>     ## For the QC computations, we really only want the S4 methods
>     ## defined in a package, so we try to exclude derived default
>     ## methods as well as methods inherited from other environments.

>     env <- as.environment(env)
>     mlist <- methods::findMethods(g, env)

>     ## Derive methods defined in package environment. Note If pkg has no
>     ## namespace, environment name of method is "".
>     pkg <- gsub("package:", "", environmentName(env))
>     mlist <- Filter(function(m)
>                     (environmentName(environment(m)) %in% c(pkg, "") &&
>                      !methods::is(m, "derivedDefaultMethod")),
>                     mlist)

>     mlist
> }

> get_S4_methods_list("summary", code_env)



More information about the Rmetrics-core mailing list