Title: | A Client for the UNHCR Popdata Platform |
---|---|
Description: | Client for the UNHCR Popdata Platform <https://popdata.unhcr.org>. Allows to download popdata datasets into R. |
Authors: | Ahmadou Dicko [aut, cre], Hisham Galal [ctb], UNHCR [cph] |
Maintainer: | Ahmadou Dicko <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.4.9000 |
Built: | 2024-10-21 04:02:20 UTC |
Source: | https://github.com/PopulationStatistics/popdata |
Augment data-frame with country metadata
pd_augment(data, col, prefix = NULL)
pd_augment(data, col, prefix = NULL)
data |
tibble, dataset to augment |
col |
unquoted expression, column containing UNHCR code |
prefix |
character, string to prepend to metadata column names |
a tibble
Manage cached POPDATA downloaded files
pd_cache_set_dir(path) pd_cache_get_dir() pd_cache_list() pd_cache_delete(file) pd_cache_clear()
pd_cache_set_dir(path) pd_cache_get_dir() pd_cache_list() pd_cache_delete(file) pd_cache_clear()
path |
character, directory to set |
file |
Character, the file to delete |
The default cache directory is
~/.cache/R/popdata
, but you can set
your own path using pd_cache_set_dir()
the cache directory
the cache directory
list of files in the cache
## Not run: pd_cache ## change the default cache directory tmp <- tempdir() pd_cache_set_dir(tmp) ## print current cache directory pd_cache_get_dir() ## List available files in the current cache directory pd_cache_list() l <- pd_cache_list()[1] ## get the first file pd_cache_delete(l) ## delete it pd_cache_clear() ## delete all cached files ## End(Not run)
## Not run: pd_cache ## change the default cache directory tmp <- tempdir() pd_cache_set_dir(tmp) ## print current cache directory pd_cache_get_dir() ## List available files in the current cache directory pd_cache_list() l <- pd_cache_list()[1] ## get the first file pd_cache_delete(l) ## delete it pd_cache_clear() ## delete all cached files ## End(Not run)
Information on the countries covered by the UNHCR Population Statistics Reference platform.
pd_countries
pd_countries
A data-frame with 226 rows and 15 variables:
The UNHCR bureau name.
The three character UNHCR code for each country (e.g. "ICO"). Note that to support the data, two non-standard codes are used for which no ISO codes are available: a. STA for Stateless; b. UKN for Unknown/other.
The three character ISO code for each country (e.g. "CIV").
The two character ISO code for each country (e.g. "CI").
The country name.
The name of the country when presented as a country of origin. Typically this is the same as the country name.
The full country name.
The official abbreviated country name.
The official country name.
The nationality of individuals from the country.
The UNSD region.
The UNSD sub-region.
The official country name in French.
The UNSD region in French.
The UNSD sub-region in French.
https://api.unhcr.org/population/v1/
Clear memory cache used to memoise popdata functions
pd_memoise_clear()
pd_memoise_clear()
R client for UNHCR popdata
Access UNHCR Popdata platform figures
popdata( report = c("asr", "mysr", "pf"), table = c("refugees", "refugeeLike", "returnees", "demographics", "idp", "rsd", "stateless", "oip", "other", "hostcommunity", "coo", "ppg", "specific", "as2", "comments"), year = 2022, quiet = getOption("popdata_quiet") ) pd_asr( table = c("refugees", "refugeelike", "refugeeLike", "returnees", "demographics", "idp", "rsd", "stateless", "oip", "other", "hostcommunity", "hostCommunity", "as2", "comments"), year = 2022, quiet = getOption("popdata_quiet") ) pd_mysr( table = c("refugees", "refugeeLike", "returnees", "idp", "rsd", "stateless", "other", "oip", "hostCommunity", "as2", "comments"), year = 2023, quiet = getOption("popdata_quiet") ) pd_pf( table = c("coo", "ppg", "specific"), year = 2020, quiet = getOption("popdata_quiet") )
popdata( report = c("asr", "mysr", "pf"), table = c("refugees", "refugeeLike", "returnees", "demographics", "idp", "rsd", "stateless", "oip", "other", "hostcommunity", "coo", "ppg", "specific", "as2", "comments"), year = 2022, quiet = getOption("popdata_quiet") ) pd_asr( table = c("refugees", "refugeelike", "refugeeLike", "returnees", "demographics", "idp", "rsd", "stateless", "oip", "other", "hostcommunity", "hostCommunity", "as2", "comments"), year = 2022, quiet = getOption("popdata_quiet") ) pd_mysr( table = c("refugees", "refugeeLike", "returnees", "idp", "rsd", "stateless", "other", "oip", "hostCommunity", "as2", "comments"), year = 2023, quiet = getOption("popdata_quiet") ) pd_pf( table = c("coo", "ppg", "specific"), year = 2020, quiet = getOption("popdata_quiet") )
report |
character, the type of report asr, mysr or pf |
table |
character, the indicator refugees, refugeeLike, returnees, demographics, idp, rsd, stateless, oip, other, hostcommunity, coo, ppg or specifics |
year |
integer, the year |
quiet |
logical, print message on updating session cookie or not. options(popdata_quiet = TRUE) can also be used |
A tibble