defdMethods: defdMethods enumerates methods defined for a class in a...

Description Usage Arguments Value Note Examples

View source: R/defdMethods.R

Description

defdMethods enumerates methods defined for a class in a package – NEEDS WORK

Usage

1
defdMethods(cl, pkg = paste0("package:", cl), verbose = TRUE)

Arguments

cl

character(1) name of class

pkg

character(1) name of package where class is defined, defaults to 'package:classname' which works for major classes like SummarizedExperiment; package: will be prepended if missing from supplied value of pkg

verbose

logical(1) if TRUE (default) will issue a message enumerating superclasses.

Value

a data.frame instance with columns 'method', 'cl', 'pkg', 'nmeth4cl', counting the number of method-signature combinations for this method, and 'sigs', a list of lists of named signature elements (each element is a list of character vectors of method parameter types, named with parameter names)

Note

Users should consider how methods inherited from superclasses defined in other packages are also relevant to reports of this type. See the example.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# start with simple tabulation of package-specific methods
suppressPackageStartupMessages({
require("SingleCellExperiment")
})
scem = defdMethods("SingleCellExperiment")
head(scem)
scem$method
scem["isSpike", "sigs"]
# now let's collect some related classes, with the objective of
# enumerating relevant coercion methods and their signatures
require("SummarizedExperiment")
se = defdMethods("SummarizedExperiment", verbose=FALSE)
rse = defdMethods("RangedSummarizedExperiment", "package:SummarizedExperiment", verbose=FALSE)
cmb = try(rbind(scem,se,rse))
require("dplyr")
require("magrittr")
tmp = (cmb %>% filter(method=="coerce"))
sl = (tmp %>% select(sigs))[[1]]
names(sl) = tmp$cl
sl

vjcitn/DrS4 documentation built on Oct. 4, 2021, 10:13 p.m.