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

