methods                package:utils                R Documentation

_L_i_s_t _M_e_t_h_o_d_s _f_o_r _S_3 _G_e_n_e_r_i_c _F_u_n_c_t_i_o_n_s _o_r _C_l_a_s_s_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     List all available methods for an S3 generic function, or all
     methods for a class.

_U_s_a_g_e:

     methods(generic.function, class)

_A_r_g_u_m_e_n_t_s:

generic.function: a generic function, or a character string naming a
          generic function.

   class: a symbol or character string naming a class: only used if
          'generic.function' is not supplied.

_D_e_t_a_i_l_s:

     Function 'methods' can be used to find out about the methods for a
     particular generic function or class.  The functions listed are
     those which _are named like methods_ and may not actually be
     methods (known exceptions are discarded in the code).  Note that
     the listed methods may not be user-visible objects, but often help
     will be available for them.

     If 'class' is used, we check that a matching generic can be found
     for each user-visible object named.  If 'generic.function' is
     given, there is a warning if it appears not to be a generic
     function. (The check for being generic used can be fooled.)

_V_a_l_u_e:

     An object of class '"MethodsFunction"', a character vector of
     function names with an '"info"' attribute. There is a 'print'
     method which marks with an asterisk any methods which are not
     visible: such functions can be examined by 'getS3method' or
     'getAnywhere'.

     The '"info"' attribute is a data frame, currently with a logical
     column, 'visible' and a factor column 'from' (indicating where the
     methods were found).

_N_o_t_e:

     This scheme is called _S3_ (S version 3).  For new projects, it is
     recommended to use the more flexible and robust _S4_ scheme
     provided in the 'methods' package.  Functions can have both S3 and
     S4 methods, and function 'showMethods' will list the S4 methods
     (possibly none).

     The original 'methods' function was written by Martin Maechler.

_R_e_f_e_r_e_n_c_e_s:

     Chambers, J. M. (1992) _Classes and methods: object-oriented
     programming in S._ Appendix A of _Statistical Models in S_ eds J.
     M. Chambers and T. J. Hastie, Wadsworth & Brooks/Cole.

_S_e_e _A_l_s_o:

     'S3Methods', 'class', 'getS3method'

_E_x_a_m_p_l_e_s:

     methods(summary)
     methods(class = "aov")
     methods("[[")    # uses C-internal dispatching
     methods("$")
     methods("$<-")   # replacement function
     methods("+")     # binary operator
     methods("Math")  # group generic
     methods("axis")  # looks like it has methods, but not generic
     ## Not run: 
     methods(print)   # over 100
     ## End(Not run)

