

Methods {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 meth-
     ods 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 writ-
     ten, 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>'.

        * 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', `pen-
               tagamma'

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

        * Group `"Ops"':

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

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

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

        * 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 and Hastie (1992). Statistical Models in S;
     Wadsworth & Brooks/Cole.

_S_e_e _A_l_s_o_:

     `methods' for methods of non-Internal generic func-
     tions.

_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. ...

