relevel                 package:base                 R Documentation

_R_e_o_r_d_e_r _L_e_v_e_l_s _o_f _F_a_c_t_o_r

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

     The levels of a factor are re-ordered so that the level specified
     by `ref' is first and the others are moved down. This is useful
     for `contr.treatment' contrasts which take the first level as the
     reference.

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

     relevel(x, ref, ...)

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

       x: An unordered factor.

     ref: The reference level.

     ...: Additional arguments for future methods.

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

     A factor of the same length as `x'.

_A_u_t_h_o_r(_s):

     B. D. Ripley

_S_e_e _A_l_s_o:

     `factor', `contr.treatment'

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

     data(warpbreaks)
     warpbreaks$tension <- relevel(warpbreaks$tension, ref="M")
     summary(lm(breaks ~ wool + tension, data=warpbreaks))

