R/standard_who.R
who_value2zscore.RdCompute z-scores or centiles with respect to the WHO growth standard for given values of x vs. y (typically x is "agedays" and y is a measure like "htcm").
who_value2zscore(x, y, x_var = "agedays", y_var = "htcm", sex = "Female", data = NULL) who_value2centile(x, y, x_var = "agedays", y_var = "htcm", sex = "Female", data = NULL)
| x | value or vector of values that correspond to a measure defined by |
|---|---|
| y | value or vector of values that correspond to a measure defined by |
| x_var | x variable name (typically "agedays") - see details |
| y_var | y variable name (typically "htcm" or "wtkg") - see details |
| sex | "Male" or "Female" |
| data | optional data frame that supplies any of the other variables provided to the function |
for all supported pairings of y_var and x_var , type names(who_coefs)
#> [1] 1.117365#> [1] 1.527048#> [1] 86.80809#> [1] 93.66255# add haz derived from WHO data and compare to that provided with data cpp$haz <- who_value2zscore(x = agedays, y = lencm, sex = sex, data = cpp) # note that you can also do it this way #' cpp$haz <- who_value2zscore(cpp$agedays, cpp$lencm, sex = cpp$sex)