CRAN packages maintained by you

Yohan Chalabi chalabi at phys.ethz.ch
Thu Apr 15 14:47:59 CEST 2010


>>>> "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?

Hi Martin,

fRegression does not import any method from Matrix pkg.

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

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


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

One option could be to update tools:::.get_S4_methods_list() with
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)


Regards,
Yohan

-- 
PhD candidate
Swiss Federal Institute of Technology
Zurich

www.ethz.ch



More information about the Rmetrics-core mailing list