Derive Reference Range Indicator
Usage
derive_var_anrind(
dataset,
signif_dig = get_admiral_option("signif_digits"),
use_a1hia1lo = FALSE
)
Arguments
- dataset
Input dataset
ANRLO
,ANRHI
, andAVAL
are expected and ifuse_a1hia1lo
is set toTRUE
,A1LO
andA1H1
are expected as well.- signif_dig
Number of significant digits to use when comparing values.
Significant digits used to avoid floating point discrepancies when comparing numeric values. See blog: How admiral handles floating points
- use_a1hia1lo
A logical value indicating whether to use
A1H1
andA1LO
in the derivation ofANRIND
.
Details
In the case that A1H1
and A1LO
are to be used, ANRIND
is set to:
"NORMAL"
ifAVAL
is greater or equalANRLO
and less than or equalANRHI
; or ifAVAL
is greater than or equalANRLO
andANRHI
is missing; or ifAVAL
is less than or equalANRHI
andANRLO
is missing"LOW"
ifAVAL
is less thanANRLO
and eitherA1LO
is missing orAVAL
is greater than or equalA1LO
"HIGH"
ifAVAL
is greater thanANRHI
and eitherA1HI
is missing orAVAL
is less than or equalA1HI
"LOW LOW"
ifAVAL
is less thanA1LO
"HIGH HIGH"
ifAVAL
is greater thanA1HI
In the case that A1H1
and A1LO
are not to be used, ANRIND
is set to:
"NORMAL"
ifAVAL
is greater or equalANRLO
and less than or equalANRHI
; or ifAVAL
is greater than or equalANRLO
andANRHI
is missing; or ifAVAL
is less than or equalANRHI
andANRLO
is missing"LOW"
ifAVAL
is less thanANRLO
"HIGH"
ifAVAL
is greater thanANRHI
See also
BDS-Findings Functions that returns variable appended to dataset:
derive_basetype_records()
,
derive_var_analysis_ratio()
,
derive_var_atoxgr()
,
derive_var_atoxgr_dir()
,
derive_var_base()
,
derive_var_chg()
,
derive_var_ontrtfl()
,
derive_var_pchg()
,
derive_var_shift()
,
derive_vars_crit_flag()
Examples
library(tibble)
library(dplyr, warn.conflicts = FALSE)
vs <- tibble::tribble(
~USUBJID, ~PARAMCD, ~AVAL, ~ANRLO, ~ANRHI, ~A1LO, ~A1HI,
"P01", "PUL", 70, 60, 100, 40, 110,
"P01", "PUL", 57, 60, 100, 40, 110,
"P01", "PUL", 60, 60, 100, 40, 110,
"P01", "DIABP", 102, 60, 80, 40, 90,
"P02", "PUL", 109, 60, 100, 40, 110,
"P02", "PUL", 100, 60, 100, 40, 110,
"P02", "DIABP", 80, 60, 80, 40, 90,
"P03", "PUL", 39, 60, 100, 40, 110,
"P03", "PUL", 40, 60, 100, 40, 110
)
vs %>% derive_var_anrind(use_a1hia1lo = TRUE)
#> # A tibble: 9 × 8
#> USUBJID PARAMCD AVAL ANRLO ANRHI A1LO A1HI ANRIND
#> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <chr>
#> 1 P01 PUL 70 60 100 40 110 NORMAL
#> 2 P01 PUL 57 60 100 40 110 LOW
#> 3 P01 PUL 60 60 100 40 110 NORMAL
#> 4 P01 DIABP 102 60 80 40 90 HIGH HIGH
#> 5 P02 PUL 109 60 100 40 110 HIGH
#> 6 P02 PUL 100 60 100 40 110 NORMAL
#> 7 P02 DIABP 80 60 80 40 90 NORMAL
#> 8 P03 PUL 39 60 100 40 110 LOW LOW
#> 9 P03 PUL 40 60 100 40 110 LOW
vs %>% derive_var_anrind(use_a1hia1lo = FALSE)
#> # A tibble: 9 × 8
#> USUBJID PARAMCD AVAL ANRLO ANRHI A1LO A1HI ANRIND
#> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <chr>
#> 1 P01 PUL 70 60 100 40 110 NORMAL
#> 2 P01 PUL 57 60 100 40 110 LOW
#> 3 P01 PUL 60 60 100 40 110 NORMAL
#> 4 P01 DIABP 102 60 80 40 90 HIGH
#> 5 P02 PUL 109 60 100 40 110 HIGH
#> 6 P02 PUL 100 60 100 40 110 NORMAL
#> 7 P02 DIABP 80 60 80 40 90 NORMAL
#> 8 P03 PUL 39 60 100 40 110 LOW
#> 9 P03 PUL 40 60 100 40 110 LOW