I have this data set with consist of ISO3166 Alpha-2 codes for countries. Example: DE, AD, AE etc They are coded as factor variables in R and there are about 173 observations.
Now because there are too many and this would just overwhelm a boxplot, I want to make a contingency table with other variables by condensing the codes and create shorter categories (also coded as factors) with the codes, for example, having
DE, RE, ED, FR-> Europe
CA, US-> North America
VF, HG, HY, TY-> South America
HG, TY, UT,FT -> Africa
How can I do that because I tried a few things that did not work.
P.S These codes are made up codes but it is just to illustrate.