Description Usage Arguments Details Value Author(s) Examples
#' This function transforms Z-scores stored in the wide matrix
to measurements using the selector method implemented in
set_refcodes()
. It is the inverse of transform_z()
.
1 2 3 4 5 6 | transform_y(
data,
znames = c("hgt_z", "wgt_z", "hdc_z", "wfh_z", "bmi_z", "dsc_z"),
pkg = "jamesyzy",
verbose = FALSE
)
|
data |
Data frame with appropriate variables, at least
|
znames |
Character vector containing the names of the Z-scores to convert. Specify this to limit the number of conversions. If not specified, the function calculates measurements for all Z-scores. |
pkg |
Name of the package that stores the growth references. By
default, |
verbose |
Set to |
By default, the function scans for variables named
hgt_z
, wgt_z
, hdc_z
, wfh_z
, bmi_z
and dsc_z
, and returns
the measurement values for any variables it finds.
The conversion of wfh_z
to wfh
is special. As wfh
is conditional
on hgt
, the calculation requires either hgt
or hgt_z
to be present
in the data. Availability of hgt
takes precedence over hgt_z
. If
only hgt_z
is known, then the function calculates hgt
from hgt_z
.
A data frame with either zero rows or the same number of rows
as nrow(data)
with colums named hgt
, wgt
, and so on.
Stef van Buuren 2021
1 2 3 | df <- data.frame(hgt_z = 0, wgt_z = 1, hdc_z = -1, age = 0.3,
sex = "male", ga = c(20, 30, 40, 50))
transform_y(df, znames = c("hdc_z", "wfh_z"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.