update.formula             package:stats             R Documentation

_M_o_d_e_l _U_p_d_a_t_i_n_g

_D_e_s_c_r_i_p_t_i_o_n:

     'update.formula' is used to update model formulae. This typically
     involves adding or dropping terms, but updates can be more
     general.

_U_s_a_g_e:

     ## S3 method for class 'formula':
     update(old, new, ...)

_A_r_g_u_m_e_n_t_s:

     old: a model formula to be updated.

     new: a formula giving a template which specifies how to update.

     ...: further arguments passed to or from other methods.

_D_e_t_a_i_l_s:

     The function works by first identifying the _left-hand side_ and
     _right-hand side_ of the 'old' formula. It then examines the 'new'
     formula and substitutes the _lhs_ of the 'old' formula for any
     occurence of "'.'" on the left of 'new', and substitutes the _rhs_
     of the 'old' formula for any occurence of "'.'" on the right of
     'new'.

_V_a_l_u_e:

     The updated formula is returned.

_S_e_e _A_l_s_o:

     'terms', 'model.matrix'.

_E_x_a_m_p_l_e_s:

     update(y ~ x,    ~ . + x2) #> y ~ x + x2
     update(y ~ x, log(.) ~ . ) #> log(y) ~ x

