From murdoch@dunc@n @ending from gm@il@com  Wed Jun 27 00:55:16 2018
From: murdoch@dunc@n @ending from gm@il@com (Duncan Murdoch)
Date: Tue, 26 Jun 2018 18:55:16 -0400
Subject: [Rd] list of methods
In-Reply-To: <bb6fa2$9mb1it@ironport10.mayo.edu>
References: <bb6fa2$9mb1it@ironport10.mayo.edu>
Message-ID: <31f369bd-9368-381f-d78b-78e2c1e360f9@gmail.com>

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



[Rd] list of methods
Duncan Murdoch