showMethods             package:methods             R Documentation

_S_h_o_w _a_l_l _t_h_e _m_e_t_h_o_d_s _f_o_r _t_h_e _s_p_e_c_i_f_i_e_d _f_u_n_c_t_i_o_n(_s)

_D_e_s_c_r_i_p_t_i_o_n:

     Show a summary of the methods for one or more generic functions,
     possibly restricted to those involving specified classes.

_U_s_a_g_e:

     showMethods(f = character(), where = topenv(parent.frame()),
                 classes = NULL, includeDefs = FALSE,
                 inherited = !includeDefs,
                 showEmpty, printTo = stdout(), fdef =)

_A_r_g_u_m_e_n_t_s:

       f: one or more function names.  If omitted, all functions will
          be shown that match the other arguments.

   where: Where to find the generic function, if not supplied as an
          argument. When 'f' is missing, or length 0, this also
          determines which generic functions to examine.  If 'where' is
          supplied, only the generic functions returned by
          'getGenerics(where)' are eligible for printing.  If 'where'
          is also missing, all the cached generic functions are
          considered.

 classes: If argument 'classes' is supplied, it is a vector of class
          names that restricts the displayed results to those methods
          whose signatures include one or more of those classes.

includeDefs: If 'includeDefs' is 'TRUE', include the definitions of the
          individual methods in the printout.

inherited: logical indicating if methods that have been found by
          inheritance, so far in the session, will be included and
          marked as inherited.  Note that an inherited method will not
          usually appear until it has been used in this session.  See
          'selectMethod' if you want to know what method would be
          dispatched for particular classes of arguments.

showEmpty: logical indicating whether methods with no defined methods
          matching the other criteria should be shown at all.  By
          default, 'TRUE' if and only if argument 'f' is not missing.

 printTo: The connection on which the information will be shown; by
          default, on standard output.

    fdef: Optionally, the generic function definition to use; if
          missing, one is found, looking in 'where' if that is
          specified. See also comment in 'Details'.

_D_e_t_a_i_l_s:

     The name and package of the generic are followed by the list of
     signatures for which methods are currently defined, according to
     the criteria determined by the various arguments.  Note that the
     package refers to the source of the generic function.  Individual
     methods for that generic can come from other packages as well.

     When more than one generic function is involved, either as
     specified or because 'f' was missing, the functions are found and
     'showMethods' is recalled for each, including the generic as the
     argument 'fdef'.  In complicated situations, this can avoid some
     anomalous results.

_V_a_l_u_e:

     If 'printTo' is 'FALSE', the character vector that would have been
     printed is returned; otherwise the value is the connection or
     filename, via 'invisible'.

_R_e_f_e_r_e_n_c_e_s:

     Chambers, John M. (2008) _Software for Data Analysis: Programming
     with R_ Springer.  (For the R version.)

     Chambers, John M. (1998) _Programming with Data_ Springer (For the
     original S4 version.)

_S_e_e _A_l_s_o:

     'setMethod', and 'GenericFunctions' for other tools involving
     methods; 'selectMethod' will show you the method dispatched for a
     particular function and signature of classes for the arguments.

_E_x_a_m_p_l_e_s:

     require(graphics)

     ## Assuming the methods for plot
     ## are set up as in the example of help(setMethod),
     ## print (without definitions) the methods that involve class "track":
     showMethods("plot", classes = "track")
     ## Not run: 
     Function "plot":
     x = ANY, y = track
     x = track, y = missing
     x = track, y = ANY

     require("Matrix")# a CRAN package with much S4 functionality
     showMethods("%*%")# many!
         methods(class = "Matrix")# nothing
     showMethods(class = "Matrix")# everything
     ## End(Not run)

     not.there <- !any("package:stats4" == search())
     if(not.there) library(stats4)
     showMethods(classes = "mle")
     if(not.there) detach("package:stats4")

