method.skeleton           package:methods           R Documentation

_C_r_e_a_t_e _a _S_k_e_l_e_t_o_n _F_i_l_e _f_o_r _a _N_e_w _M_e_t_h_o_d

_D_e_s_c_r_i_p_t_i_o_n:

     This function writes a source file containing a call to
     'setMethod' to define a method for the generic function and
     signature supplied.  By default the method definition is in line
     in the call, but can be made an external (previously assigned)
     function.

_U_s_a_g_e:

     method.skeleton(generic, signature, file, external = FALSE, where)

_A_r_g_u_m_e_n_t_s:

 generic: the character string name of the generic function, or the
          generic function itself.  In the first case, the function
          need not currently be a generic, as it would not for the
          resulting call to 'setMethod'.

signature: the method signature, as it would be given to 'setMethod'

    file: a character string name for the output file, or a writable
          connection.  By default the generic function name and the
          classes in the signature are concatenated, with separating
          underscore characters.  The file name should normally end in
          '".R"'. 

external: flag to control whether the function definition for the
          method should be a separate external object assigned in the
          source file, or included in line in the call to 'setMethod'.
          If supplied as a character string, this will be used as the
          name for the external function; by default the name
          concatenates the generic and signature names, with separating
          underscores.

   where: The environment in which to look for the function; by
          default, the top-level environment of the call to
          'method.skeleton'.

_V_a_l_u_e:

     The 'file' argument, invisibly, but the function is used for its
     side effect.

_S_e_e _A_l_s_o:

     'setMethod', 'package.skeleton'

_E_x_a_m_p_l_e_s:

     setClass("track", representation(x ="numeric", y="numeric"))
     method.skeleton("show", "track")            ## writes show_track.R
     method.skeleton("Ops", c("track", "track")) ## writes "Ops_track_track.R"

     ## write multiple method skeletons to one file
     con <- file("./Math_track.R", "w")
     method.skeleton("Math", "track", con)
     method.skeleton("exp", "track", con)
     method.skeleton("log", "track", con)
     close(con)

