Methods                 package:base                 R Documentation

_I_n_t_e_r_n_a_l _a_n_d _G_r_o_u_p _M_e_t_h_o_d_s _a_n_d _G_e_n_e_r_i_c _F_u_n_c_t_i_o_n_s

_D_e_s_c_r_i_p_t_i_o_n:

     Many R-internal functions  are generic and  allow methods to be
     written for.  Group methods in particular are available for the
     `"Math"',  `"Ops"', and `"Summary"' group.

_U_s_a_g_e:

     Math.data.frame(x, ...)
     Math.factor(x, ...)

     Ops.data.frame(e1, e2 = NULL)
     Ops.factor(e1, e2)
     Ops.ordered(e1, e2)

     Summary.data.frame(x, ...)
     Summary.factor(x, ...)

     .Method
     .Generic
     .Group
     .Class

_G_r_o_u_p _D_i_s_p_a_t_c_h_i_n_g:

     There are three groups for which methods can be written, namely
     the `"Math"', `"Ops"' and `"Summary"' groups.

     A function `f' belonging to one of these groups must be
     `.Internal' or `.Primitive' and will automatically be using
     `<grp>.<class> (ob)' when `f(<ob>)' is called, `f' belongs to
     group `<grp>' and `<ob>' is of `class' `<class>'.

        1.  Group `"Math"':

           *  `abs', `sign', `sqrt', 
              `floor', `ceiling', `trunc',
              `round', `signif'

           *  `exp', `log', 
              `cos', `sin', `tan',
              `acos', `asin', `atan'

              `cosh', `sinh', `tanh',
              `acosh', `asinh', `atanh'

           *  `lgamma', `gamma', `gammaCody',
              `digamma', `trigamma', `tetragamma', `pentagamma'

           *  `cumsum', `cumprod', `cummax', `cummin'


        2.  Group `"Ops"':

           *  `"+"', `"-"', `"*"', `"/"', `"^"', `"%%"', `"%/%"'

           *  `"&"', `"|"', `"!"'

           *  `"=="', `"!="',  `"<"', `"<="', `">="', `">"'


        3.  Group `"Summary"':

           *  `all', `any'

           *  `sum', `prod'

           *  `min', `max'

_S_i_m_p_l_e _D_i_s_p_a_t_c_h_i_n_g:

     The following builtin functions are generic as well, i.e., you can
     write `methods' for them:

     `[',             `[['            

     `dimnames<-',    `dimnames',      `dim<-',         `dim'           

     `c',  `unlist',  `as.vector',  `is.na',  `is.nan'

_R_e_f_e_r_e_n_c_e_s:

     Appendix A, Classes and Methods of
     Chambers, J. M.  and Hastie, T. J. eds (1992) Statistical Models
     in S. Wadsworth & Brooks/Cole.

_S_e_e _A_l_s_o:

     `methods' for methods of non-Internal generic functions.

_E_x_a_m_p_l_e_s:

     methods("Math")
     methods("Ops")
     methods("Summary")

     d.fr <- data.frame(x=1:9, y=rnorm(9))
     data.class(1 + d.fr) == "data.frame" ##-- add to d.f. ...

