Find surveys available in PIP drive
pip_find_data.Rd
This function was deprecated because DLW data will loaded directly from a
flat folder structure which allows bypassing the use of datalibweb
in
Stata, making the pipdp
Stata package useless.From now on, use the dlw
functions: pip_load_dlw_inventory
, pip_find_dlw
, and pip_load_dlw
.
Usage
pip_find_data(
country = NULL,
year = NULL,
survey_acronym = NULL,
vermast = NULL,
veralt = NULL,
module = NULL,
tool = NULL,
condition = NULL,
source = NULL,
root_dir = Sys.getenv("PIP_ROOT_DIR"),
maindir = pip_create_globals(root_dir)$PIP_DATA_DIR,
inv_file = fs::path(maindir, "_inventory/inventory.fst"),
filter_to_pc = FALSE,
filter_to_tb = FALSE,
verbose = getOption("pipload.verbose")
)
Arguments
- country
character: vector of ISO3 country codes.
- year
numeric: survey year
- survey_acronym
character: Survey acronym
- vermast
character: Master version in the form v## or ##
- veralt
character: Alternative version in the form v## or ##
- module
character: combination of
tool
andsource
separated by a hyphen (e.g., PC-GPWG)- tool
character: PIP tool in which data will be used. It could be
PC
for Poverty Calculator orTB
for Table Maker. Others will be added- condition
character: logical condition that applies to all surveys. For example, "year > 2012". Make sure the condition uses the names of the variables in
pip_load_inventory()
: orig, filename, country_code, year, survey_acronym, vermast, veralt, collection, module, tool, and source. Can't be used with argumentscountry
,year
,survey_acronym
,vermast
,veralt
,module
ortool
.- source
character: Source of data. It could be
GPWG
,HIST
,GROUP
,synth
,BIN
, andALL
. The latter is used only in Table Maker.- root_dir
character: root directory of the PIP data
- maindir
character: Main directory
- inv_file
character: file path to be loaded.
- filter_to_pc
logical: If TRUE filter most recent data to be included in the Poverty Calculator. Default if FALSE
- filter_to_tb
logical: If TRUE filter most recent data to be included in the Table Maker. Default if FALSE
- verbose
logical: whether to display message. Default is TRUE
Examples
# all years for one country
pip_find_data(country = "ARG")
#> ! root_dir is not defined. Directory paths will lack network-drive root
#> directory
#> Error: [EACCES] Failed to make directory '/PIP-Data_QA': permission denied
#' # all years for more than one country
pip_find_data(country = c("COL", "ARG"))
#> ! root_dir is not defined. Directory paths will lack network-drive root
#> directory
#> Error: [EACCES] Failed to make directory '/PIP-Data_QA': permission denied
# specific years for one country
pip_find_data(
country = "COL",
year = c(2010, 2012)
)
#> ! root_dir is not defined. Directory paths will lack network-drive root
#> directory
#> Error: [EACCES] Failed to make directory '/PIP-Data_QA': permission denied
# country FHF does not exist so it will be part of `fail` output (No error)
pip_find_data(
country = c("ARG", "FHF"),
year = 2010
)
#> ! root_dir is not defined. Directory paths will lack network-drive root
#> directory
#> Error: [EACCES] Failed to make directory '/PIP-Data_QA': permission denied
# Load a different module (e.g., GPWG)
pip_find_data(country = "PRY",
year = 2010,
module = "PC-GPWG")
#> ! root_dir is not defined. Directory paths will lack network-drive root
#> directory
#> Error: [EACCES] Failed to make directory '/PIP-Data_QA': permission denied
# Load different sources
pip_find_data(country = "COL",
source = "HIST")
#> ! root_dir is not defined. Directory paths will lack network-drive root
#> directory
#> Error: [EACCES] Failed to make directory '/PIP-Data_QA': permission denied
if (FALSE) {
# more than two years for more than one country (only firt year will be used)
pip_find_data(
country = c("COL", "ARG"),
year = c(2010, 2012)
)
# all countries and years
pip_find_data()
}