R/derive_param_qtc.R
derive_param_qtc.Rd
Adds a record for corrected QT using either Bazett's, Fridericia's or Sagie's formula for each by group (e.g., subject and visit) where the source parameters are available.
Note: This is a wrapper function for the more generic derive_param_computed()
.
derive_param_qtc(
dataset,
by_vars,
method,
set_values_to = default_qtc_paramcd(method),
qt_code = "QT",
rr_code = "RR",
get_unit_expr,
filter = NULL
)
Input dataset
The variables specified by the by_vars
and get_unit_expr
arguments are expected to be in the dataset.
PARAMCD
, and AVAL
are expected as well.
The variable specified by by_vars
and PARAMCD
must be a unique key of
the input dataset after restricting it by the filter condition (filter
argument) and to the parameters specified by qt_code
and rr_code
.
none
Grouping variables
Only variables specified in by_vars
will be populated
in the newly created records.
list of variables created by exprs()
, e.g., exprs(USUBJID, VISIT)
none
Method used to QT correction
See compute_qtc()
for details.
"Bazett"
, "Fridericia"
, "Sagie"
none
Variables to be set
The specified variables are set to the specified values for the new
observations. For example exprs(PARAMCD = "MAP")
defines the parameter code
for the new parameter.
List of variable-value pairs
exprs(PARAMCD = "MAP")
QT parameter code
The observations where PARAMCD
equals the specified value are considered
as the QT interval assessments. It is expected that QT is measured in ms or
msec.
character value
"QT"
RR parameter code
The observations where PARAMCD
equals the specified value are considered
as the RR interval assessments. It is expected that RR is measured in ms or
msec.
character value
"RR"
An expression providing the unit of the parameter
The result is used to check the units of the input parameters.
An expression which is evaluable in the input dataset and results in a character value
none
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.
an unquoted condition, e.g., AVISIT == "BASELINE"
NULL
The input dataset with the new parameter added. Note, a variable will only
be populated in the new parameter rows if it is specified in by_vars
.
BDS-Findings Functions for adding Parameters/Records:
default_qtc_paramcd()
,
derive_expected_records()
,
derive_extreme_event()
,
derive_extreme_records()
,
derive_locf_records()
,
derive_param_bmi()
,
derive_param_bsa()
,
derive_param_computed()
,
derive_param_doseint()
,
derive_param_exist_flag()
,
derive_param_exposure()
,
derive_param_framingham()
,
derive_param_map()
,
derive_param_rr()
,
derive_param_wbc_abs()
,
derive_summary_records()
library(tibble)
adeg <- tribble(
~USUBJID, ~PARAMCD, ~PARAM, ~AVAL, ~AVALU, ~VISIT,
"01-701-1015", "HR", "Heart Rate (beats/min)", 70.14, "beats/min", "BASELINE",
"01-701-1015", "QT", "QT Duration (ms)", 370, "ms", "WEEK 2",
"01-701-1015", "HR", "Heart Rate (beats/min)", 62.66, "beats/min", "WEEK 1",
"01-701-1015", "RR", "RR Duration (ms)", 710, "ms", "WEEK 2",
"01-701-1028", "HR", "Heart Rate (beats/min)", 85.45, "beats/min", "BASELINE",
"01-701-1028", "QT", "QT Duration (ms)", 480, "ms", "WEEK 2",
"01-701-1028", "QT", "QT Duration (ms)", 350, "ms", "WEEK 3",
"01-701-1028", "HR", "Heart Rate (beats/min)", 56.54, "beats/min", "WEEK 3",
"01-701-1028", "RR", "RR Duration (ms)", 842, "ms", "WEEK 2"
)
derive_param_qtc(
adeg,
by_vars = exprs(USUBJID, VISIT),
method = "Bazett",
set_values_to = exprs(
PARAMCD = "QTCBR",
PARAM = "QTcB - Bazett's Correction Formula Rederived (ms)",
AVALU = "ms"
),
get_unit_expr = AVALU
)
#> # A tibble: 11 × 6
#> USUBJID PARAMCD PARAM AVAL AVALU VISIT
#> <chr> <chr> <chr> <dbl> <chr> <chr>
#> 1 01-701-1015 HR Heart Rate (beats/min) 70.1 beat… BASE…
#> 2 01-701-1015 QT QT Duration (ms) 370 ms WEEK…
#> 3 01-701-1015 HR Heart Rate (beats/min) 62.7 beat… WEEK…
#> 4 01-701-1015 RR RR Duration (ms) 710 ms WEEK…
#> 5 01-701-1028 HR Heart Rate (beats/min) 85.4 beat… BASE…
#> 6 01-701-1028 QT QT Duration (ms) 480 ms WEEK…
#> 7 01-701-1028 QT QT Duration (ms) 350 ms WEEK…
#> 8 01-701-1028 HR Heart Rate (beats/min) 56.5 beat… WEEK…
#> 9 01-701-1028 RR RR Duration (ms) 842 ms WEEK…
#> 10 01-701-1015 QTCBR QTcB - Bazett's Correction Formula Red… 439. ms WEEK…
#> 11 01-701-1028 QTCBR QTcB - Bazett's Correction Formula Red… 523. ms WEEK…
derive_param_qtc(
adeg,
by_vars = exprs(USUBJID, VISIT),
method = "Fridericia",
set_values_to = exprs(
PARAMCD = "QTCFR",
PARAM = "QTcF - Fridericia's Correction Formula Rederived (ms)",
AVALU = "ms"
),
get_unit_expr = extract_unit(PARAM)
)
#> # A tibble: 11 × 6
#> USUBJID PARAMCD PARAM AVAL AVALU VISIT
#> <chr> <chr> <chr> <dbl> <chr> <chr>
#> 1 01-701-1015 HR Heart Rate (beats/min) 70.1 beat… BASE…
#> 2 01-701-1015 QT QT Duration (ms) 370 ms WEEK…
#> 3 01-701-1015 HR Heart Rate (beats/min) 62.7 beat… WEEK…
#> 4 01-701-1015 RR RR Duration (ms) 710 ms WEEK…
#> 5 01-701-1028 HR Heart Rate (beats/min) 85.4 beat… BASE…
#> 6 01-701-1028 QT QT Duration (ms) 480 ms WEEK…
#> 7 01-701-1028 QT QT Duration (ms) 350 ms WEEK…
#> 8 01-701-1028 HR Heart Rate (beats/min) 56.5 beat… WEEK…
#> 9 01-701-1028 RR RR Duration (ms) 842 ms WEEK…
#> 10 01-701-1015 QTCFR QTcF - Fridericia's Correction Formula… 415. ms WEEK…
#> 11 01-701-1028 QTCFR QTcF - Fridericia's Correction Formula… 508. ms WEEK…
derive_param_qtc(
adeg,
by_vars = exprs(USUBJID, VISIT),
method = "Sagie",
set_values_to = exprs(
PARAMCD = "QTLCR",
PARAM = "QTlc - Sagie's Correction Formula Rederived (ms)",
AVALU = "ms"
),
get_unit_expr = extract_unit(PARAM)
)
#> # A tibble: 11 × 6
#> USUBJID PARAMCD PARAM AVAL AVALU VISIT
#> <chr> <chr> <chr> <dbl> <chr> <chr>
#> 1 01-701-1015 HR Heart Rate (beats/min) 70.1 beat… BASE…
#> 2 01-701-1015 QT QT Duration (ms) 370 ms WEEK…
#> 3 01-701-1015 HR Heart Rate (beats/min) 62.7 beat… WEEK…
#> 4 01-701-1015 RR RR Duration (ms) 710 ms WEEK…
#> 5 01-701-1028 HR Heart Rate (beats/min) 85.4 beat… BASE…
#> 6 01-701-1028 QT QT Duration (ms) 480 ms WEEK…
#> 7 01-701-1028 QT QT Duration (ms) 350 ms WEEK…
#> 8 01-701-1028 HR Heart Rate (beats/min) 56.5 beat… WEEK…
#> 9 01-701-1028 RR RR Duration (ms) 842 ms WEEK…
#> 10 01-701-1015 QTLCR QTlc - Sagie's Correction Formula Rede… 415. ms WEEK…
#> 11 01-701-1028 QTLCR QTlc - Sagie's Correction Formula Rede… 504. ms WEEK…