transform2y | R Documentation |
#' 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 transform2z()
.
transform2y(
data,
znames = c("hgt_z", "wgt_z", "hdc_z", "wfh_z", "bmi_z", "dsc_z"),
pkg = "nlreferences",
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 |
... |
Arguments passed down 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
df <- data.frame(hgt_z = 0, wgt_z = 1, hdc_z = -1, age = 0.3,
sex = "male", ga = c(20, 30, 40, 50))
transform2y(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.