I have two data frames, one with economic information for various countries and the other with the proper names of the countries. The two data frames look like this:
country <- c("Afghanistan", "Afghanistan", "United States", "United States", "Congo, Dem. Rep.", "Congo, Dem. Rep.", "Middle East and North Africa", "Middle East and North Africa")
years <- c(2011, 2012, 2011, 2012, 2011, 2012, 2011, 2012)
gdp <- c(123, 442, 9451, 9999, 351, 664, 7531, 6634)
economic_data <- cbind.data.frame(country, years, gdp)
country_proper <- c("Afghanistan", "United States of America", "Congo DR")
I want to change the names of the countries in economic_data to their proper names in the country_proper data, and then drop the countries in economic_data which do not appear in country_proper (like "Middle East and North Africa").