View source: R/cow_iso_clean.R
cow_iso_clean | R Documentation |
countrycode::countrycode()
CoW > ISO3 conversion.Given a data.frame
with ISO3 country codes that were derived from a
countrycode::countrycode()
cown > iso3c
formula, clean up the common
errors in coding respective to an additional designation for the year of the
observation.
cow_iso_clean(x, cow.col, iso3.col, year.col)
x |
A |
cow.col |
A character string of the column name with numeric CoW codes. |
iso3.col |
A character string of the column name with ISO3 character codes. |
year.col |
A character string of the column name for country-year observation. |
countrycode::countrycode()
can result in messy ISO3 conversions;
especially when historic data is included. This cleans up some common
post-WWII historical (and other current bugs present at the time of
publishing) ISO3C codes that are useful but no longer part of the current
slate of ISO3C. The
ISO_3166-1_alpha-3
Wikipedia page was used as reference for this function.
A data.frame
.
vdem<-demcon::get_vdem()
vdem$iso3<-countrycode::countrycode(vdem$COWcode, origin = "cown", destination = "iso3c")
vdem<-demcon::cow_iso_clean(x = vdem, cow.col = "COWcode", iso3.col = "iso3", year.col = "year")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.