[Rd] list of methods
Duncan Murdoch
murdoch@dunc@n @ending from gm@il@com
Wed Jun 27 00:55:16 CEST 2018
On 26/06/2018 2:24 PM, Therneau, Terry M., Ph.D. via R-devel wrote:
> I recently got a request to add head() and tail() methods for Surv objects, which is quite
> reasonable, but not unlike other requests for logLik, vcov, extractAIC, ... What they
> all have in common is that are methods added since creation of the survival package, and
> that I didn't know they existed.
>
> To try and get ahead of the curve, is there a way to list names of all of the default
> methods? There are functions to get all the instances of a method by name, e.g.
> methods("extractAIC") or find all the methods already implemented for a class, but I don't
> see something give me a list of the ones that I haven't created yet.
There are a lot of default methods; most of them are probably irrelevant
to you. But if you want to see them, here's one way:
basepkgs <- rownames(subset(as.data.frame(installed.packages()),
Priority == "base"))
for (pkg in basepkgs) {
print(ls(getNamespace(pkg), pattern = ".default$"))
}
This only shows the ones in base packages. If you expand to 'Priority
== "recommended"' or something even less restrictive, you'll get more.
Duncan Murdoch
More information about the R-devel
mailing list