\begin{Schunk}
\begin{Sinput}
 ##IDEO
 table(anes1$V045117, exclude = NULL)
\end{Sinput}
\begin{Soutput}
                  01. Extremely liberal 
                                     20 
                            02. Liberal 
                                    103 
                   03. Slightly liberal 
                                    125 
        04. Moderate;middle of the road 
                                    279 
              05. Slightly conservative 
                                    143 
                       06. Conservative 
                                    166 
             07. Extremely conservative 
                                     31 
80. Haven't thought much {DO NOT PROBE} 
                                      0 
                         88. Don't know 
                                      0 
                            89. Refused 
                                      0 
                                   <NA> 
                                    345 
\end{Soutput}
\begin{Sinput}
 ideolevels <- data.frame(levels_old = levels(anes1$V045117),
                 levels_new = c("EL","L","SL","M","SC","C","EC", NA, NA, NA),
                 stringsAsFactors = FALSE)
 anes1$V045117 <- mapvalues(anes1$V045117, from = ideolevels$levels_old, to = ideolevels$levels_new)
 anes1$V043116 <- anes1$V045117[, drop = TRUE]
 table(anes1.orig$V045117, anes1$V045117)
\end{Sinput}
\begin{Soutput}
                                           EL   L
  01. Extremely liberal                    20   0
  02. Liberal                               0 103
  03. Slightly liberal                      0   0
  04. Moderate;middle of the road           0   0
  05. Slightly conservative                 0   0
  06. Conservative                          0   0
  07. Extremely conservative                0   0
  80. Haven't thought much {DO NOT PROBE}   0   0
  88. Don't know                            0   0
  89. Refused                               0   0
                                         
                                           SL   M
  01. Extremely liberal                     0   0
  02. Liberal                               0   0
  03. Slightly liberal                    125   0
  04. Moderate;middle of the road           0 279
  05. Slightly conservative                 0   0
  06. Conservative                          0   0
  07. Extremely conservative                0   0
  80. Haven't thought much {DO NOT PROBE}   0   0
  88. Don't know                            0   0
  89. Refused                               0   0
                                         
                                           SC   C
  01. Extremely liberal                     0   0
  02. Liberal                               0   0
  03. Slightly liberal                      0   0
  04. Moderate;middle of the road           0   0
  05. Slightly conservative               143   0
  06. Conservative                          0 166
  07. Extremely conservative                0   0
  80. Haven't thought much {DO NOT PROBE}   0   0
  88. Don't know                            0   0
  89. Refused                               0   0
                                         
                                           EC
  01. Extremely liberal                     0
  02. Liberal                               0
  03. Slightly liberal                      0
  04. Moderate;middle of the road           0
  05. Slightly conservative                 0
  06. Conservative                          0
  07. Extremely conservative               31
  80. Haven't thought much {DO NOT PROBE}   0
  88. Don't know                            0
  89. Refused                               0
\end{Soutput}
\end{Schunk}
