Description Usage Arguments Details Value Author(s) Examples
View source: R/derive_advs_params.R
Adds a record for BMI/Body Mass Index using Weight and Height each by group (e.g., subject and visit) where the source parameters are available.
1 2 3 4 5 6 7 8 9 | derive_param_bmi(
dataset,
by_vars,
set_values_to = vars(PARAMCD = "BMI"),
weight_code = "WEIGHT",
height_code = "HEIGHT",
get_unit_expr,
filter = NULL
)
|
dataset |
Input dataset The variables specified by the The variable specified by |
by_vars |
Grouping variables For each group defined by Permitted Values: list of variables |
set_values_to |
Variables to be set The specified variables are set to the specified values for the new
observations. For example Permitted Values: List of variable-value pairs |
weight_code |
WEIGHT parameter code The observations where Permitted Values: character value |
height_code |
HEIGHT parameter code The observations where Permitted Values: character value |
get_unit_expr |
An expression providing the unit of the parameter The result is used to check the units of the input parameters. Permitted Values: A variable of the input dataset or a function call |
filter |
Filter condition The specified condition is applied to the input dataset before deriving the new parameter, i.e., only observations fulfilling the condition are taken into account. Permitted Values: a condition |
The analysis value of the new parameter is derived as
BMI = \frac{WEIGHT}{HEIGHT^2}
The input dataset with the new parameter added
Pavan Kumar
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | advs <- tibble::tribble(
~USUBJID, ~PARAMCD, ~PARAM, ~AVAL, ~AVALU, ~AVISIT,
"01-701-1015", "HEIGHT", "Height (cm)", 147, "cm", "SCREENING",
"01-701-1015", "WEIGHT", "Weight (kg)", 54.0, "kg", "SCREENING",
"01-701-1015", "WEIGHT", "Weight (kg)", 54.4, "kg", "BASELINE",
"01-701-1015", "WEIGHT", "Weight (kg)", 53.1, "kg", "WEEK 2",
"01-701-1028", "HEIGHT", "Height (cm)", 163, "cm", "SCREENING",
"01-701-1028", "WEIGHT", "Weight (kg)", 78.5, "kg", "SCREENING",
"01-701-1028", "WEIGHT", "Weight (kg)", 80.3, "kg", "BASELINE",
"01-701-1028", "WEIGHT", "Weight (kg)", 80.7, "kg", "WEEK 2"
)
derive_param_bmi (
advs,
by_vars = vars(USUBJID, AVISIT),
weight_code = "WEIGHT",
height_code = "HEIGHT",
set_values_to = vars(
PARAMCD = "BMI",
PARAM = "Body Mass Index (kg/m^2)"
),
get_unit_expr = extract_unit(PARAM)
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.