load_reference: Load growth reference

View source: R/load_reference.R

load_referenceR Documentation

Load growth reference

Description

This function searches for references stored in the sysdata.dta object in package pkg. If refcode is a reference then

Usage

load_reference(
  refcode = NULL,
  element = c("all", "table", "index", "study"),
  pkg = "centile",
  verbose = FALSE
)

Arguments

refcode

String, code of a reference. Only the first element is loaded. Alternatively, if refcode is a reference, the function uses it.

element

Keyword, either "all", "table", "index" or "study". The default is "all".

pkg

The package containing the reference. The package must be loaded and attached. The default pkg = "centile" searches in the home package.

verbose

For more verbose output, set to TRUE.

Value

The return value depends on the element parameter.

element Return value
"all" All stored information
"table" A tibble with reference values
"index" Numeric vector with index values
"study" Named character vector with study data

Examples

# use a built-in reference
ref <- load_reference("who_2006_wgt_male_")
head(ref)
head(attr(ref, "study"))

# use verbose = TRUE to find out problems
ref <- load_reference("nl_1997_hgt_male_nl", verbose = TRUE)

growthcharts/yzy documentation built on Oct. 28, 2024, 10:32 a.m.