\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}
 levels_old <- levels(anes1$V045117)
 levels_old
\end{Sinput}
\begin{Soutput}
 [1] "01. Extremely liberal"                  
 [2] "02. Liberal"                            
 [3] "03. Slightly liberal"                   
 [4] "04. Moderate;middle of the road"        
 [5] "05. Slightly conservative"              
 [6] "06. Conservative"                       
 [7] "07. Extremely conservative"             
 [8] "80. Haven't thought much {DO NOT PROBE}"
 [9] "88. Don't know"                         
[10] "89. Refused"                            
\end{Soutput}
\begin{Sinput}
 levels_new <- c("EL", "L", "SL", "M", "SC", "C", "EC", NA, NA, NA)
 ideolevels <- data.frame(levels_old = levels_old,
                 levels_new = levels_new,
                 stringsAsFactors = FALSE)
 ideolevels
\end{Sinput}
\begin{Soutput}
                                levels_old levels_new
1                    01. Extremely liberal         EL
2                              02. Liberal          L
3                     03. Slightly liberal         SL
4          04. Moderate;middle of the road          M
5                05. Slightly conservative         SC
6                         06. Conservative          C
7               07. Extremely conservative         EC
8  80. Haven't thought much {DO NOT PROBE}       <NA>
9                           88. Don't know       <NA>
10                             89. Refused       <NA>
\end{Soutput}
\end{Schunk}
