\Header{contrasts}{Get and Set Contrast Matrices}
\alias{contrasts$\leftarrow $}{contrasts}
\keyword{design}{contrasts}
\keyword{regression}{contrasts}
\begin{Usage}
\begin{verbatim}
contrasts(x)
contrasts(x) <- ctr
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\texttt{x}] a factor.
\item[\texttt{ctr}] either a matrix whose columns give coefficients
for contrasts in the levels of \texttt{x}, or the (quoted)
name of a function which computes such matrices.
\end{ldescription}
\end{Arguments}
\begin{Value}
These functions are used to set and view the
contrasts associated with a factor.
If contrasts are not set for a factor the default
functions from \texttt{\Link{options}("contrasts")} are used.\end{Value}
\begin{SeeAlso}
\texttt{\Link{C}}, \texttt{\Link{contr.helmert}}, \texttt{\Link{contr.poly}},
\texttt{\Link{contr.sum}}, \texttt{\Link{contr.treatment}},
\texttt{\Link{glm}}, \texttt{\Link{aov}}, \texttt{\Link{lm}}.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
example(factor)
(fff <- factor(ff))
contrasts(fff) # treatment
contrasts(C(fff, sum))
\end{ExampleCode}
\end{Examples}

