derive_params_growth_height {admiralpeds} | R Documentation |
Derive Anthropometric indicators (Z-Scores/Percentiles-for-Height/Length) based on Standard Growth Charts
Description
Derive Anthropometric indicators (Z-Scores/Percentiles-for-Height/Length) based on Standard Growth Charts for Weight by Height/Length
Usage
derive_params_growth_height(
dataset,
sex,
height,
height_unit,
meta_criteria,
parameter,
analysis_var,
who_correction = FALSE,
set_values_to_sds = NULL,
set_values_to_pctl = NULL
)
Arguments
dataset |
Input dataset The variables specified in |
sex |
Sex A character vector is expected. Expected Values: |
height |
Current Height/length A numeric vector is expected. Note that this is the actual height/length at the current visit. |
height_unit |
Height/Length Unit A character vector is expected. Expected values: |
meta_criteria |
Metadata dataset A metadata dataset with the following expected variables:
The dataset can be derived from WHO or user-defined datasets. The WHO growth chart metadata datasets are available in the package and will require small modifications. Datasets If the
|
parameter |
Anthropometric measurement parameter to calculate z-score or percentile A condition is expected with the input dataset e.g. There is WHO metadata available for Weight available in the |
analysis_var |
Variable containing anthropometric measurement A numeric vector is expected, e.g. |
who_correction |
WHO adjustment for weight-based indicators A logical scalar, e.g. |
set_values_to_sds |
Variables to be set for Z-Scores The specified variables are set to the specified values for the new
observations. For example,
The formula to calculate the Z-score is as follows:
where "obs" is the observed value for the respective anthropometric measure being calculated. Permitted Values: List of variable-value pairs If left as default value, |
set_values_to_pctl |
Variables to be set for Percentile The specified variables are set to the specified values for the new
observations. For example,
Permitted Values: List of variable-value pair If left as default value, |
Value
The input dataset additional records with the new parameter added.
See Also
Vital Signs Functions for adding Parameters/Records
derive_params_growth_age()
Examples
library(dplyr, warn.conflicts = FALSE)
library(lubridate, warn.conflicts = FALSE)
library(rlang, warn.conflicts = FALSE)
library(admiral, warn.conflicts = FALSE)
library(pharmaversesdtm, warn.conflicts = FALSE)
# derive weight for height/length only for those under 2 years old using WHO
# weight for length reference file
advs <- pharmaversesdtm::dm_peds %>%
select(USUBJID, BRTHDTC, SEX) %>%
right_join(., pharmaversesdtm::vs_peds, by = "USUBJID") %>%
mutate(
VSDT = ymd(VSDTC),
BRTHDT = ymd(BRTHDTC)
) %>%
derive_vars_duration(
new_var = AAGECUR,
new_var_unit = AAGECURU,
start_date = BRTHDT,
end_date = VSDT,
out_unit = "days"
)
heights <- pharmaversesdtm::vs_peds %>%
filter(VSTESTCD == "HEIGHT") %>%
select(USUBJID, VSSTRESN, VSSTRESU, VSDTC) %>%
rename(
HGTTMP = VSSTRESN,
HGTTMPU = VSSTRESU
)
advs <- advs %>%
right_join(., heights, by = c("USUBJID", "VSDTC"))
advs_under2 <- advs %>%
filter(AAGECUR < 730.5)
who_under2 <- bind_rows(
(admiralpeds::who_wt_for_lgth_boys %>%
mutate(
SEX = "M",
height_unit = "cm"
)
),
(admiralpeds::who_wt_for_lgth_girls %>%
mutate(
SEX = "F",
height_unit = "cm"
)
)
) %>%
rename(
HEIGHT_LENGTH = Length,
HEIGHT_LENGTHU = height_unit
)
derive_params_growth_height(
advs_under2,
sex = SEX,
height = HGTTMP,
height_unit = HGTTMPU,
meta_criteria = who_under2,
parameter = VSTESTCD == "WEIGHT",
analysis_var = VSSTRESN,
who_correction = TRUE,
set_values_to_sds = exprs(
PARAMCD = "WGTHSDS",
PARAM = "Weight-for-height/length z-score"
),
set_values_to_pctl = exprs(
PARAMCD = "WGTHPCTL",
PARAM = "Weight-for-height/length percentile"
)
)