contrasts                package:base                R Documentation

_G_e_t _a_n_d _S_e_t _C_o_n_t_r_a_s_t _M_a_t_r_i_c_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     Set and view the contrasts associated with a factor.

_U_s_a_g_e:

     contrasts(x)
     contrasts(x) <- ctr

_A_r_g_u_m_e_n_t_s:

       x: a factor.

     ctr: either a matrix whose columns give coefficients for contrasts
          in the levels of `x', or the (quoted) name of a function
          which computes such matrices.

_D_e_t_a_i_l_s:

     If contrasts are not set for a factor the default functions from
     `options("contrasts")' are used.

_S_e_e _A_l_s_o:

     `C', `contr.helmert', `contr.poly', `contr.sum',
     `contr.treatment'; `glm', `aov', `lm'.

_E_x_a_m_p_l_e_s:

     example(factor)
     (fff <- factor(ff))
     contrasts(fff) # treatment
     contrasts(C(fff, sum))

