Skip to content

Commit

Permalink
dhs: integrade to codelist
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentarelbundock committed May 7, 2020
1 parent dcb1674 commit d5b8a13
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 6 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ Authors@R: c(
person("Nils", "Enevoldsen", email = "[email protected]", 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:
Expand Down
5 changes: 5 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -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)
--------------------------

Expand Down
1 change: 1 addition & 0 deletions R/codelist.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion R/countrycode.R
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Binary file modified data/backup.rds
Binary file not shown.
Binary file modified data/codelist.rda
Binary file not shown.
Binary file modified data/codelist_panel.rda
Binary file not shown.
1 change: 1 addition & 0 deletions dictionary/build.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions dictionary/get_dhs.R
Original file line number Diff line number Diff line change
@@ -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)
}
1 change: 1 addition & 0 deletions man/codelist.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d5b8a13

Please sign in to comment.