home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Educational / R-0.49-MI / R-0.49-M / help / base / class < prev    next >
Encoding:
Text File  |  1997-04-23  |  1.5 KB  |  43 lines

  1.     
  2.     _O_b_j_e_c_t _C_l_a_s_s_e_s
  3.     
  4.          class(x)
  5.          class(x) <- names
  6.          unclass(x)
  7.          inherits(x, name)
  8.          is.object(x)
  9.     
  10.     _D_e_s_c_r_i_p_t_i_o_n:
  11.     
  12.          R possesses a simple generic function mechanism which
  13.          can be used for an object-oriented style of program-
  14.          ming.  Method despatch takes place based on the class
  15.          of the first argument to the generic function.
  16.     
  17.          An R ``object'' is a data object which has a class
  18.          attribute.  A class attribute is a vector of character
  19.          strings giving the names of the classes which the
  20.          object ``inherits'' from.  When a generic function fun
  21.          is applied to an object with class attribute
  22.          c("first","second"), the system searches for a function
  23.          called fun.first and, if it finds it, applied it to the
  24.          object.  If no such function is found a function called
  25.          fun.second is tried.  If no class name produces a suit-
  26.          able function, the function fun.default is used.
  27.     
  28.          The function class prints the vector of names of
  29.          classes which an object inherits from.  Correspond-
  30.          ingly, class<- sets the classes which an object inher-
  31.          its from.  unclass returns (a copy of) its argument
  32.          with its class information removed.
  33.     
  34.          is.object returns TRUE if its argument has a class
  35.          attribute and FALSE otherwise.  inherits indicates
  36.          whether its first argument inherits from a class with
  37.          name equal to its second argument.
  38.     
  39.     _S_e_e _A_l_s_o:
  40.     
  41.          UseMethod, NextMethod.
  42.     
  43.