I am trying to get the respective continents for a vector of country names in a data frame. I'm using the countrycode package to do so, but keep getting NA's returned as my destination. Example code I'm using:
country <- data.frame(country = c("Chile", "Argentina", "Poland"))
country %>%
mutate(continent = countrycode(sourcevar = 'country', origin = 'country.name', destination = 'region'))
I apologize if this is repeated but I'm not sure what I'm doing wrong here.
CodePudding user response:
Kindly let me know if this is what you were anticipating.
country %>%
mutate(continent = countrycode(sourcevar = country, origin = 'country.name', destination = 'region'))