My Data
The data are from a large survey in a set of developing countries. The data include, among other things, variables on each respondent's country and local region (within the country).
The only problem is that, instead of coding local region as strings (such as "New York" or "Westchester County", it is coded as numeric, which correspond to a list of regions in the codebook.
My Question
What I would like to know is whether there's a way to automate the process of re-naming the factors using the codelist from the codebook. Each region is preceded by a numeric value and an equals sign, and is followed immediately by a comma.
This list takes this form:
1=New York, 2=Paris, 3=London, 4=Moscow, 5=Boston, ..., 230=Tblisi Is there some R code that might allow me to quickly rename all the factors in this variable using this list?