getS4               package:fUtilities               R Documentation

_G_e_n_e_r_a_l _S_4 _C_l_a_s_s _E_x_t_r_a_c_t_o_r _F_u_n_c_t_i_o_n_s

_D_e_s_c_r_i_p_t_i_o_n:

     A collection and description of functions to extract slots from S4
     class objects. 

     The extractor functions are:

       'isS4'            Checks if an object is a S4 object,
       'getCall'         Extracts the call slot from a S4 object,
       'getModel'        Extracts the model slot from a S4 object,
       'getTitle'        Extracts the title slot from a S4 object,
       'getDescription'  Extracts the description slot from a S4 object,
       'getSlot'         Extracts a specified slot from a S4 object.

_U_s_a_g_e:

     isS4(object)

     getCall(object)
     getModel(object)
     getTitle(object)
     getDescription(object)

     getSlot(object, slotName)

_A_r_g_u_m_e_n_t_s:

  object: an object of class S4. 

slotName: a character string, the name of the slot to be extracted from
          the  S4 object. 

_V_a_l_u_e:

     'isS4'

     returns either TRUR or FALSE depending if the argument is an
     object of class S4 or not.

     'getCall'
      'getModel'
      'getTitle'
      'getDescription'
      'getSlot'
      return the content of the slot.

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

     ## Example S4 Representation:
        # Hyothesis Testing with Control Settings 
        setClass("hypTest", 
          representation(
            call = "call",
            data = "numeric",
            test = "list",
            description = "character")  
        )
        
     ## Shapiro Wilk Normaility Test
        swTest = function(x, description = "") {
          ans = shapiro.test(x)
          class(ans) = "list"
          new("hypTest", 
            call = match.call(), 
            data = x, 
            test = ans,
            description = description)
        }
        test = swTest(x = rnorm(500), description = "500 RVs")
        
     ## Extractor Functions:
        isS4(test)
        getCall(test)
        getDescription(test)

