diff --git a/DESCRIPTION b/DESCRIPTION index 78db6cb..2999408 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -11,11 +11,11 @@ Authors@R: c( person("Nils", "Enevoldsen", email = "nils@wlonk.com", role = "ctb", comment = c(ORCID = "0000-0001-7195-4117")) ) Description: Standardize country names, convert them into one of - eleven coding schemes, convert between coding schemes, and + 40 different coding schemes, convert between coding schemes, and assign region descriptors. -Version: 1.1.2 +Version: 1.1.3 URL: https://github.com/vincentarelbundock/countrycode -Date: 2020-04-22 +Date: 2020-05-07 Depends: R (>= 2.10) Suggests: diff --git a/NEWS b/NEWS index 327943c..0d04716 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +Version 1.1.3 (2020-05-07) +-------------------------- + +* Added Demographic and Health Surveys (thanks to @mcooper) + Version 1.1.2 (2020-04-22) -------------------------- diff --git a/R/codelist.R b/R/codelist.R index 659adc5..237ffb9 100644 --- a/R/codelist.R +++ b/R/codelist.R @@ -9,6 +9,7 @@ #' \item country.name.de: country name (German) #' \item cowc: Correlates of War character #' \item cown: Correlates of War numeric +#' \item dhs: Demographic and Health Surveys Program #' \item ecb: European Central Bank #' \item eurostat: Eurostat #' \item fao: Food and Agriculture Organization of the United Nations numerical code diff --git a/R/countrycode.R b/R/countrycode.R index 0d04335..1ed2eed 100644 --- a/R/countrycode.R +++ b/R/countrycode.R @@ -85,7 +85,7 @@ countrycode <- function(sourcevar, origin, destination, warn = TRUE, nomatch = N } else { dictionary = countrycode::codelist # Modify this manually when adding codes - valid_origin = c("country.name", "country.name.de", "cowc", "cown", + valid_origin = c("country.name", "country.name.de", "cowc", "cown", "dhs", "ecb", "eurostat", "fao", "fips", "gaul", "genc2c", "genc3c", "genc3n", "gwc", "gwn", "imf", "ioc", "iso2c", "iso3c", "iso3n", "p4c", "p4n", "un", "un_m49", "unpd", diff --git a/data/backup.rds b/data/backup.rds index ef5d000..dd77791 100644 Binary files a/data/backup.rds and b/data/backup.rds differ diff --git a/data/codelist.rda b/data/codelist.rda index 4bcf57d..e599bfc 100644 Binary files a/data/codelist.rda and b/data/codelist.rda differ diff --git a/data/codelist_panel.rda b/data/codelist_panel.rda index 4caf7b6..b6f6213 100644 Binary files a/data/codelist_panel.rda and b/data/codelist_panel.rda differ diff --git a/dictionary/build.R b/dictionary/build.R index 958b04b..180ab3d 100644 --- a/dictionary/build.R +++ b/dictionary/build.R @@ -4,6 +4,7 @@ source('dictionary/utilities.R') # Source: TRUE -- web source has priority. FALSE -- backup source has priority. src = c('cldr' = FALSE, 'cow_cs' = FALSE, + 'dhs' = FALSE, 'ecb' = FALSE, 'eurostat' = FALSE, 'fao' = FALSE, diff --git a/dictionary/get_dhs.R b/dictionary/get_dhs.R index 05ab8d1..cb9cdbc 100644 --- a/dictionary/get_dhs.R +++ b/dictionary/get_dhs.R @@ -1,9 +1,9 @@ get_dhs = function() { url = 'https://api.dhsprogram.com/rest/dhs/countries?select=DHS_CountryCode,CountryName&f=json' dhs = jsonlite::fromJSON(url)[['Data']] %>% - dplyr::select(CountryName, DHS_CountryCode) %>% + dplyr::select(CountryName, dhs = DHS_CountryCode) %>% dplyr::mutate(country.name.en.regex = CountryToRegex(CountryName)) %>% dplyr::select(-CountryName) %>% - dplyr::filter(DHS_CountryCode != 'OS') + dplyr::filter(dhs != 'OS') return(dhs) } diff --git a/man/codelist.Rd b/man/codelist.Rd index 0e11fd8..13bd1c8 100644 --- a/man/codelist.Rd +++ b/man/codelist.Rd @@ -18,6 +18,7 @@ Origin and Destination: \item country.name.de: country name (German) \item cowc: Correlates of War character \item cown: Correlates of War numeric + \item dhs: Demographic and Health Surveys Program \item ecb: European Central Bank \item eurostat: Eurostat \item fao: Food and Agriculture Organization of the United Nations numerical code