relevel                package:stats                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'.

_S_e_e _A_l_s_o:

     'factor', 'contr.treatment', 'levels', 'reorder'.

_E_x_a_m_p_l_e_s:

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

