slot                 package:methods                 R Documentation

_T_h_e _S_l_o_t_s _i_n _a_n _O_b_j_e_c_t _f_r_o_m _a _F_o_r_m_a_l _C_l_a_s_s

_D_e_s_c_r_i_p_t_i_o_n:

     These functions return or set information about the individual
     slots in an object.

_U_s_a_g_e:

     object@name
     object@name <- value

     slot(object, name)
     slot(object, name) <- value

     slotNames(x)

_A_r_g_u_m_e_n_t_s:

  object: An object from a formally defined class.

    name: The character-string name of the slot. The name must be a
          valid slot name:  see Details below.

   value: 

       x: Either the name of a class or an object from that class.
          Print `getClass(class)' to see the full description of the
          slots.

_D_e_t_a_i_l_s:

     The `"@"' operator and the `slot' function extract or replace the
     formally defined slots for the object.  The operator takes a fixed
     name, which can be unquoted if it is syntactically a name in the
     language.  A slot name can be any non-empty string, but if the
     name is not made up of letters, numbers, and `"."', it needs to be
     quoted.

     In the case of the `slot' function, the slot name can be any
     expression that evaluates to a valid slot in the class definition.
     Generally, the only reason to use the functional form rather than
     the simpler operator is because the slot name has to be computed.

     The definition of the class contains the names of all slots
     diretly and indirectly defined.  Each slot has a name and an
     associated class.  Extracting a slot returns an object from that
     class.  Setting a slot first coerces the value to the specified
     slot and then stores it.

     Unlike attributes, slots are not partially matched, and asking for
     (or trying to set) a slot with an invalid name for that class
     generates an error.

_A_u_t_h_o_r(_s):

     John Chambers

_R_e_f_e_r_e_n_c_e_s:

     Chambers, J. M. (1998) Programming with Data, Springer.

     The web page <URL: http://www.omegahat.org/RSMethods/index.html>
     is the primary documentation.

_S_e_e _A_l_s_o:

     `@', `Classes', `Methods', `getClass'

_E_x_a_m_p_l_e_s:

     slot(myTrack, "x")
     slot(myTrack, "y") <- log(slot(myTrack, "x"))

     slotNames("track")

