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, check = TRUE) <- 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: A new value for the named slot.  The value must be valid for
          this slot in this object's class.

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

   check: If 'TRUE', check the assigned value for validity as the value
          of this slot.  You should never set this to 'FALSE' in normal
          use, since the result can create invalid objects. 

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

_R_e_f_e_r_e_n_c_e_s:

     The R package 'methods' implements, with a few exceptions, the
     programming interface for classes and methods in the book
     _Programming with Data_ (John M. Chambers, Springer, 1998), in
     particular sections 1.6, 2.7, 2.8, and chapters 7 and 8.

     While the programming interface for the 'methods' package follows
     the reference, the R software is an original implementation, so
     details in the reference that reflect the S4 implementation may
     appear differently in R.  Also, there are extensions to the
     programming interface developed more recently than the reference. 
     For a discussion of details and ongoing development, see the web
     page  <URL: http://developer.r-project.org/methodsPackage.html>
     and the pointers from that page.

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

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

_E_x_a_m_p_l_e_s:

     ## Not run: 
     slot(myTrack, "x")
     slot(myTrack, "y") <- log(slot(myTrack, "x"))

     slotNames("track")
     ## End(Not run)

