Description Usage Arguments Details Value Author(s) Examples
View source: R/derive_advs_params.R
Adds a record for mean arterial pressure (MAP) for each by group (e.g., subject and visit) where the source parameters are available.
1 2 3 4 5 6 7 8 9 10 | derive_param_map(
dataset,
by_vars,
set_values_to = vars(PARAMCD = "MAP"),
sysbp_code = "SYSBP",
diabp_code = "DIABP",
hr_code = NULL,
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 |
sysbp_code |
Systolic blood pressure parameter code The observations where Permitted Values: character value |
diabp_code |
Diastolic blood pressure parameter code The observations where Permitted Values: character value |
hr_code |
Heart rate 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
(2DIABP + SYSBP) / 3
if it is based on diastolic and systolic blood pressure and
DIABP + 0.01 exp(4.14 - 40.74 / HR) (SYSBP - DIABP)
if it is based on diastolic, systolic blood pressure, and heart rate.
The input dataset with the new parameter added
Stefan Bundfuss
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | library(dplyr, warn.conflicts = FALSE)
advs <- tibble::tribble(
~USUBJID, ~PARAMCD, ~PARAM, ~AVAL, ~AVALU, ~VISIT,
"01-701-1015", "PULSE", "Pulse (beats/min)" , 59, "beats/min", "BASELINE",
"01-701-1015", "PULSE", "Pulse (beats/min)" , 61, "beats/min", "WEEK 2",
"01-701-1015", "DIABP", "Diastolic Blood Pressure (mmHg)", 51, "mmHg", "BASELINE",
"01-701-1015", "DIABP", "Diastolic Blood Pressure (mmHg)", 50, "mmHg", "WEEK 2",
"01-701-1015", "SYSBP", "Systolic Blood Pressure (mmHg)", 121, "mmHg", "BASELINE",
"01-701-1015", "SYSBP", "Systolic Blood Pressure (mmHg)", 121, "mmHg", "WEEK 2",
"01-701-1028", "PULSE", "Pulse (beats/min)" , 62, "beats/min", "BASELINE",
"01-701-1028", "PULSE", "Pulse (beats/min)" , 77, "beats/min", "WEEK 2",
"01-701-1028", "DIABP", "Diastolic Blood Pressure (mmHg)", 79, "mmHg", "BASELINE",
"01-701-1028", "DIABP", "Diastolic Blood Pressure (mmHg)", 80, "mmHg", "WEEK 2",
"01-701-1028", "SYSBP", "Systolic Blood Pressure (mmHg)", 130, "mmHg", "BASELINE",
"01-701-1028", "SYSBP", "Systolic Blood Pressure (mmHg)", 132, "mmHg", "WEEK 2"
)
# Derive MAP based on diastolic and systolic blood pressure
advs %>%
derive_param_map(
by_vars = vars(USUBJID, VISIT),
set_values_to = vars(
PARAMCD = "MAP",
PARAM = "Mean Arterial Pressure (mmHg)"
),
get_unit_expr = AVALU
) %>%
filter(PARAMCD != "PULSE")
# Derive MAP based on diastolic and systolic blood pressure and heart rate
derive_param_map(
advs,
by_vars = vars(USUBJID, VISIT),
hr_code = "PULSE",
set_values_to = vars(
PARAMCD = "MAP",
PARAM = "Mean Arterial Pressure (mmHg)"
),
get_unit_expr = extract_unit(PARAM)
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.