\begin{Schunk}
\begin{Sinput}
 dat$w9 <- mapvalues(dat$w2, from = c("f", "g", "h"), 
            to = c("fgh", "fgh","fgh"))
 table(dat$w9)
\end{Sinput}
\begin{Soutput}
fgh   i   j 
 30  13   5 
\end{Soutput}
\end{Schunk}
