isS4                  package:base                  R Documentation

_T_e_s_t _f_o_r _a_n _S_4 _o_b_j_e_c_t

_D_e_s_c_r_i_p_t_i_o_n:

     Tests whether the object is an instance of an S4 class.

_U_s_a_g_e:

     isS4(object)

     asS4(object, value = TRUE)

_A_r_g_u_m_e_n_t_s:

  object: Any R object. 

   value: A single logical value; not 'NA'.

_D_e_t_a_i_l_s:

     Note that 'isS4' does not rely on the 'methods' package, so in
     particular it can be used to detect the need to 'require' that
     package.  (But 'asS4' does depend on 'methods'.)

     You should not set the flag directly unless you really know why. 
     As from R 2.6.0, S4 methods are restricted to S4 objects for
     primitive functions; 'asS4' allows method dispatch of S4 methods
     on primitives for S3 classes. For all other purposes, an object
     will satisfy 'isS4(x)' if and only if it should.

     Note that S4 methods can only be set on those primitives which are
     'internal generic' and '%*%'.

_V_a_l_u_e:

     'isS4' always returns 'TRUE' or 'FALSE' according to whether the
     internal flag marking an S4 object has been turned on for this
     object.

     'asS4' will turn this flag on or off. But see the details.

_S_e_e _A_l_s_o:

     'is.object'

_E_x_a_m_p_l_e_s:

     isS4(pi) # FALSE
     isS4(getClass("MethodDefinition")) # TRUE

