\begin{Schunk}
\begin{Sinput}
 rm2.dm <- model.matrix(posAffect ~ ethnicity, data = dat)
 head(rm2.dm)
\end{Sinput}
\begin{Soutput}
  (Intercept) ethnicityBlack ethnicityHispanic
1           1              0                 1
2           1              0                 0
3           1              0                 0
4           1              0                 0
5           1              0                 0
6           1              0                 0
  ethnicityWhite
1              0
2              1
3              1
4              1
5              1
6              1
\end{Soutput}
\end{Schunk}
