check.options           package:grDevices           R Documentation

_S_e_t _O_p_t_i_o_n_s _w_i_t_h _C_o_n_s_i_s_t_e_n_c_y _C_h_e_c_k_s

_D_e_s_c_r_i_p_t_i_o_n:

     Utility function for setting options with some consistency checks.
     The 'attributes' of the new settings in 'new' are checked for
     consistency with the _model_ (often default) list in 'name.opt'.

_U_s_a_g_e:

     check.options(new, name.opt, reset = FALSE, assign.opt = FALSE,
                   envir = .GlobalEnv,
                   check.attributes = c("mode", "length"),
                   override.check = FALSE)

_A_r_g_u_m_e_n_t_s:

     new: a _named_ list

name.opt: character with the name of R object containing the default
          list.

   reset: logical; if 'TRUE', reset the options from 'name.opt'.  If
          there is more than one R object with name 'name.opt', remove
          the first one in the 'search()' path.

assign.opt: logical; if 'TRUE', assign the ...

   envir: the 'environment' used for 'get' and 'assign'.

check.attributes: character containing the attributes which
          'check.options' should check.

override.check: logical vector of length 'length(new)' (or 1 which
          entails recycling). For those 'new[i]' where
          'override.check[i] == TRUE', the checks are overridden and
          the changes made anyway.

_V_a_l_u_e:

     A list of components with the same names as the one called
     'name.opt'. The values of the components are changed from the
     'new' list, as long as these pass the checks (when these are not
     overridden according to 'override.check').

_N_o_t_e:

     Option '"names"' is exempt from all the checks or warnings, as in
     the application it can be 'NULL' or a variable-length character
     vector.

_A_u_t_h_o_r(_s):

     Martin Maechler

_S_e_e _A_l_s_o:

     'ps.options' and 'pdf.options', which use 'check.options'.

_E_x_a_m_p_l_e_s:

     (L1 <- list(a=1:3, b=pi, ch="CH"))
     check.options(list(a=0:2), name.opt = "L1")
     check.options(NULL, reset = TRUE, name.opt = "L1")

