ModelEnv-class          package:modeltools          R Documentation

_C_l_a_s_s "_M_o_d_e_l_E_n_v"

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

     A class for model environments.

_D_e_t_a_i_l_s:

     Objects of class 'ModelEnv' basically consist of an 'environment'
     for data storage as well as 'get' and 'set' methods.

     'na.fail' returns 'FALSE' when at least one missing value occurs
     in 'object@env'. 'na.pass' returns 'object' unchanged and
     'na.omit' returns a copy of 'object' with all missing values
     removed.

_O_b_j_e_c_t_s _f_r_o_m _t_h_e _C_l_a_s_s:

     Objects can be created by calls of the form 'new("ModelEnv",
     ...)'.

_S_l_o_t_s:

     '_e_n_v': Object of class '"environment"'.

     '_g_e_t': Object of class '"function"' for extracting objects from
          environment 'env'.

     '_s_e_t': Object of class '"function"' for setting object in
          environment 'env'.

_M_e_t_h_o_d_s:

     _c_l_o_n_e 'signature(object = "ModelEnv")': copy an object. 

     _d_i_m_e_n_s_i_o_n 'signature(object = "ModelEnv", which = "character")':
          get the dimension of an object. 

     _h_a_s 'signature(object = "ModelEnv", which = "character")': check
          if an object 'which' is available in 'env'. 

     _i_n_i_t_i_a_l_i_z_e 'signature(.Object = "ModelEnv")': setup new objects.

     _s_h_o_w 'signature(object = "ModelEnv")': show object. 

     _s_u_b_s_e_t 'signature(x = "ModelEnv")': extract subsets from an
          object. 

     _n_a._p_a_s_s 'na.action' method for 'ModelEnv' objects.

     _n_a._f_a_i_l 'na.action' method for 'ModelEnv' objects.

     _n_a._o_m_i_t 'na.action' method for 'ModelEnv' objects.

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

     ### a new object
     me <- new("ModelEnv")

     ### define a bivariate response variable
     me@set("response", data.frame(y = rnorm(10), x = runif(10)))
     me

     ### check if a response is available
     has(me, "response")

     ### the dimensions
     dimension(me, "response")

     ### extract the data
     me@get("response")

     ### NA handling
     df <- data.frame(x = rnorm(10), y = rnorm(10))
     df$x[1] <- NA
     mf <- ModelEnvFormula(x ~ y, data = df, na.action = na.pass)
     mf
     na.omit(mf)

