Displaying 3 results from an estimated 3 matches for "s3methodsinnamespac".
Did you mean:
s3methodsinnamespace
2015 Jul 07
3
List S3 methods and defining packages
Hi,
from the man page ?methods, I expected to be able to build pairs
(class,package) for a given S3 method, e.g., print, using
attr(methods(print), 'info').
However all the methods, except the ones defined in base or S4
methods, get the 'from' value "registered S3method for print", instead
of the actual package name (see below for the first rows).
Is this normal
2015 Jul 07
0
List S3 methods and defining packages
...#39; -- the namespace in which the generic to
which the method belongs is defined, and the namespace in which the method is
defined. I think the former is what you're interested in, but the latter likely
what methods() might be modified return.
For your use case, maybe something like
.S3methodsInNamespace <- function(envir, pattern) {
mtable <- get(".__S3MethodsTable__.", envir = asNamespace(envir))
methods <- ls(mtable, pattern = pattern)
env <- vapply(methods, function(x) {
environmentName(environment(get(x, mtable)))
}, chara...
2015 Jul 08
0
List S3 methods and defining packages
...s defined, and the namespace in which the
>>> method is defined. I think the former is what you're interested in, but the
>>> latter likely what methods() might be modified return.
>>>
>>> For your use case, maybe something like
>>>
>>> .S3methodsInNamespace <- function(envir, pattern) {
>>> mtable <- get(".__S3MethodsTable__.", envir = asNamespace(envir))
>>> methods <- ls(mtable, pattern = pattern)
>>> env <- vapply(methods, function(x) {
>>> environmentNam...