pip_load_aux: Load any auxiliary data

View source: R/pip_load_aux.R

pip_load_auxR Documentation

Load any auxiliary data

Description

Load any auxiliary data

Usage

pip_load_aux(
  measure = NULL,
  root_dir = Sys.getenv("PIP_ROOT_DIR"),
  maindir = pip_create_globals(root_dir)$PIP_DATA_DIR,
  msrdir = fs::path(maindir, "_aux", measure),
  version = NULL,
  file_to_load = NULL,
  apply_label = TRUE,
  verbose = getOption("pipload.verbose"),
  preferred_format = NULL
)

Arguments

measure

character: Measure to be used. e.g., "cpi" or "ppp".

root_dir

character: root directory of the PIP data

maindir

character: main directory. By default it uses pip_create_globals(root_dir)$PIP_DATA_DIR

msrdir

character: measure (CPI) directory. created on pip_prices().

version

An integer or a quoted directive. "available": displays list of available versions for measure. "select"|"pick"|"choose": allows user to select the vintage of measure. if the integer is a zero or a negative number (e.g., -1), pip_load_aux will load that number of versions before the most recent version available. So, if 0, it loads the current version. If -1, it will load the version before the current, -2 loads two versions before the current one, and so on. If it is a positive number, it must be quoted (as character) and in the form "%Y%m%d%H%M%S".

file_to_load

character: file path to load. Does not work with any other argument

apply_label

logical: if TRUE, predefined labels will apply to data loaded using file_to_load argument. Default TRUE. Tip: change to FALSE if the main structure of data has changed and labels have not been updated

verbose

logical: whether to display message. Default is TRUE

preferred_format

character: preferred format. default is "fst".

Value

data.table

Examples

# Load CPI
cpi <- pip_load_aux("cpi")

# load PPP
ppp <- pip_load_aux("ppp")

# Load GDP
gdp <- pip_load_aux("gdp")

measure <- "cpi"
av      <- pip_load_aux(measure, version = "available")
head(av)
df      <- pip_load_aux(measure, version = av[1])
head(df)
df      <- pip_load_aux(measure, version = -1)
head(df)
## Not run: 
df      <- pip_load_aux(measure, version = "pick")

## End(Not run)

PIP-Technical-Team/pipload documentation built on March 22, 2022, 3:22 a.m.