source_functions: Simplified shared function sourcing

Description Usage Arguments Examples

View source: R/source_functions.R

Description

More concise way of sourcing shared functions without having to remember the full file path. Can source multiple functions at a time or all of them at once. All arguments for shared functions must be logical (ie. TRUE)

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
source_functions(create_connection_string = FALSE,
  get_best_model_versions = FALSE, get_cause_metadata = FALSE,
  get_covariate_estimates = TRUE, get_demographics = FALSE,
  get_bundle_data = FALSE, get_ids = FALSE, get_location_metadata = FALSE,
  get_rei_metadata = FALSE, get_restrictions = FALSE,
  model_custom = FALSE, upload_bundle_data = FALSE,
  validate_input_sheet = FALSE, get_cod_data = FALSE,
  get_envelope = FALSE, get_envelope_with_shock = FALSE,
  get_life_table = FALSE, get_life_table_with_shock = FALSE,
  get_model_results = FALSE, get_population = FALSE, get_draws = FALSE,
  get_outputs = FALSE, interpolate = FALSE, save_results_cod = FALSE,
  save_results_epi = FALSE, get_pct_change = FALSE,
  make_aggregates = FALSE, save_results_covariates = FALSE,
  save_results_risk = FALSE, split_cod_model = FALSE,
  split_epi_model = FALSE, all = FALSE, folder = "current/r/")

Arguments

create_connection_string

provides the credentials to access GBD databases. Not currently avaiable for GBD 2017.

get_best_model_versions

queries gbd team specific databases (cod, epi, covariate) for best model versions based on GBD team and id.

get_cause_metadata

returns cause hierarchy information. By default it will provide the current best version of whatever cause set is specified. The full list of valid cause sets are in shared.cause_set

get_covariate_estimates

retrieve covariate esitmates in database. By default it returns all demographics, but you can optionally specify a subset. Also by default it retrives the best covariate model from the current GBD round, you can alternatively specify

get_demographics

Given a gbd team (cod/epi/epi_ar/cov/mort) and a gbd round, return an dictionary with proper demographic ids.

get_bundle_data

read epi data directly into memory, allowing users to bypass the download button in the epiupload webpage. Only active data for a single bundle_id can be retrieved.

get_ids

A simple table lookup function used to return a dataframe of entity (example: <e2><80><98>cause<e2><80><99>, <e2><80><98>rei<e2><80><99>) ids and names

get_location_metadata

Return a location hierarchy for a given location set id, or version id

get_rei_metadata

Returns rei hiearchy with additional metadata. Given a rei set id, return a rei hierarchy. By default, returns the current best version for gbd 2017.

get_restrictions

Return restrictions for sex, measure, or age for given combinations of causes and those dimensions

model_custom

deprecated function

upload_bundle_data

Process upload request for a given file. Works for bundles associated with either dismod or stgpr.

validate_input_sheet

run validations on a file independent of running a full upload

get_cod_data

Returns a dataframe of cod data for a given cause, a given cause set version and a given location set version

get_envelope

Returns a dataframe of all-cause envelope for a set of given ages locations, years, and sexes, and given envelope specifications corresponding to <e2><80><9c>best<e2><80><9d> status. If -1 is an input, runs on all possible values of that argument. Accepts -1 for ages, locations, sexes, and years

get_envelope_with_shock

Coming soon.

get_life_table

Returns a dataframe of life table values for a set of given ages,locations, years, and sexes, a given status, and given envelope specifications. If -1 is an input, runs on all possible values of that argument. Accepts -1 for ages, locations, sexes, years, and life_table_parameter_ids.

get_life_table_with_shock

Coming soon.

get_model_results

Returns the best/latest/version_id-specific model results for the given arguments

get_population

Returns a dataframe of populations for a set of given ages, locations,years, and sexes, and a given status. If <e2><80><98>all<e2><80><99> is an input, runs on all possible values of that argument. Accepts <e2><80><98>all<e2><80><99> for ages, locations, sexes, and years

get_draws

for reading draw files. The function is designed to support reading draws from specific points in the GBD process.

get_outputs

Get_outputs is a function used to retrieve our final results from the GBD outputs database. This is the same database that GBD-Compare uses.

interpolate

wrapper function that lives inside of draw_ops which brings together both gopher.draws to pull the draws, maths.interpolate to interpolate draws, and maths.extrapolate to back-interpolate the draws to 1980 for applicable measures and sources.

save_results_cod

The save_results package allows researchers to upload custom models for further processing in the GBD pipeline.

save_results_epi

The save_results package allows researchers to upload custom models for further processing in the GBD pipeline.

get_pct_change

calculates the percent change between two years for a given set of demographics and ids at the draw level.

make_aggregates

Coming soon.

save_results_covariates

The save_results package allows researchers to upload custom models for further processing in the GBD pipeline.

save_results_risk

The save_results package allows researchers to upload custom models for further processing in the GBD pipeline.

split_cod_model

useful if you have a one cod model (e.g. Liver cancer, p0) that you want to split into a number of sub-cause cod models (e.g. due to Hepatitis B (p1), due to Hepatitis C (p2), due to Alcohol Use (p3), and due to Other (p4))

split_epi_model

useful if you have a one model (e.g. prevalence of dementia, p0) that you want to split into a number of sub-models (e.g. mild, moderate, and severe dementia; p1, p2, and p3 respectively).

all

set to TRUE if you want to source all available shared functions in the selected folder (default: current/r)

folder

the folder where the shared functions are checked for, defaults to current/r. Change only if you know which older version you want to source

Examples

1
2
3
source_functions(get_cod_data = TRUE)
source_functions(get_cause_metadata = TRUE, save_results_cod = TRUE)
source_functions(all = TRUE)

ShadeWilson/ihme documentation built on May 20, 2019, 8:47 a.m.