\begin{Schunk}
\begin{Sinput}
 table(dat$Sex)
\end{Sinput}
\begin{Soutput}
  1   2 
195 185 
\end{Soutput}
\begin{Sinput}
 dat$gender <- factor(dat$Sex, levels = c(1,2), labels = c("male", "female"))
 dat$ethnicity <- as.factor(ifelse(dat$Ethnic2, "Black",
                             ifelse(dat$Ethnic3, "Hispanic",
                             ifelse(dat$Ethnic4, "Asian", "White"))))
 dat$race <- rockchalk::combineLevels(dat$ethnicity,  levs = c("Black", "Hispanic", "Asian"), newLabel = "Nonwhite")
\end{Sinput}
\begin{Soutput}
The original levels Asian Black Hispanic White 
have been replaced by White Nonwhite 
\end{Soutput}
\begin{Sinput}
 options("width" = 60)
 head(dat)
\end{Sinput}
\begin{Soutput}
  Agency1 Agency2 Agency3 Intrin1 Intrin2 Intrin3 Extrin1
1  3.5000  4.0000  4.0000  4.0000     4.0       4  1.0000
2  2.5000  3.1667  3.0000  3.2123     2.0       3  1.8333
3  1.8333  2.0000  1.5000  3.0000     3.0       2  1.0000
4  2.7714  3.0602  2.3639  3.1337     4.0       3  1.0774
5  3.1667  3.3333  2.8333  3.5000     4.0       4  1.8333
6  2.3333  2.8333  2.3333  3.0000     2.5       3  3.0588
  Extrin2 Extrin3 PosAFF1 PosAFF2 PosAFF3 NegAFF1 NegAFF2
1  1.0000  1.5000  4.0000     4.0     4.0     1.0  1.0000
2  2.6667  1.8333  3.0000     3.5     2.5     1.5  1.6858
3  1.0000  1.0000  3.0184     2.5     3.0     1.0  1.0000
4  1.1667  1.0000  3.0000     2.5     3.0     2.5  2.5000
5  2.0000  1.8333  3.7804     3.5     3.0     2.5  2.0000
6  2.4125  2.6667  4.0000     3.0     3.0     2.0  1.5000
  NegAFF3 Sex Ethnic2 Ethnic3 Ethnic4   agency intMotiv
1     1.0   1       0       1       0 3.833333 4.000000
2     1.5   1       0       0       0 2.888900 2.737433
3     1.0   1       0       0       0 1.777767 2.666667
4     1.5   1       0       0       0 2.731833 3.377900
5     3.0   1       0       0       0 3.111100 3.833333
6     2.0   1       0       0       0 2.499967 2.833333
  extMotiv posAffect negAffect gender ethnicity     race
1 1.166667  4.000000  1.000000   male  Hispanic Nonwhite
2 2.111100  3.000000  1.561933   male     White    White
3 1.000000  2.839467  1.000000   male     White    White
4 1.081367  2.833333  2.166667   male     White    White
5 1.888867  3.426800  2.500000   male     White    White
6 2.712667  3.333333  1.833333   male     White    White
\end{Soutput}
\begin{Sinput}
 options("width" = 80)
\end{Sinput}
\end{Schunk}
