Derive Reference Range Indicator
Details
ANRIND is set to
"NORMAL"ifAVALis greater or equalANRLOand less than or equalANRHI; or ifAVALis greater than or equalANRLOandANRHIis missing; or ifAVALis less than or equalANRHIandANRLOis missing"LOW"ifAVALis less thanANRLOand eitherA1LOis missing orAVALis greater than or equalA1LO"HIGH"ifAVALis greater thanANRHIand eitherA1HIis missing orAVALis less than or equalA1HI"LOW LOW"ifAVALis less thanA1LO"HIGH HIGH"ifAVALis greater thanA1HI
See also
BDS-Findings Functions that returns variable appended to dataset:
derive_var_analysis_ratio(),
derive_var_atoxgr_dir(),
derive_var_atoxgr(),
derive_var_basetype(),
derive_var_base(),
derive_var_chg(),
derive_var_ontrtfl(),
derive_var_pchg(),
derive_var_shift()
Examples
library(tibble)
library(dplyr, warn.conflicts = FALSE)
library(admiral.test)
data(admiral_vs)
ref_ranges <- tribble(
~PARAMCD, ~ANRLO, ~ANRHI, ~A1LO, ~A1HI,
"DIABP", 60, 80, 40, 90,
"PULSE", 60, 100, 40, 110
)
admiral_vs %>%
mutate(
PARAMCD = VSTESTCD,
AVAL = VSSTRESN
) %>%
filter(PARAMCD %in% c("PULSE", "DIABP")) %>%
derive_vars_merged(ref_ranges, by_vars = exprs(PARAMCD)) %>%
derive_var_anrind() %>%
select(USUBJID, PARAMCD, AVAL, ANRLO:ANRIND)
#> # A tibble: 16,411 x 8
#> USUBJID PARAMCD AVAL ANRLO ANRHI A1LO A1HI ANRIND
#> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <chr>
#> 1 01-701-1015 DIABP 64 60 80 40 90 NORMAL
#> 2 01-701-1015 DIABP 83 60 80 40 90 HIGH
#> 3 01-701-1015 DIABP 57 60 80 40 90 LOW
#> 4 01-701-1015 DIABP 68 60 80 40 90 NORMAL
#> 5 01-701-1015 DIABP 59 60 80 40 90 LOW
#> 6 01-701-1015 DIABP 71 60 80 40 90 NORMAL
#> 7 01-701-1015 DIABP 56 60 80 40 90 LOW
#> 8 01-701-1015 DIABP 51 60 80 40 90 LOW
#> 9 01-701-1015 DIABP 61 60 80 40 90 NORMAL
#> 10 01-701-1015 DIABP 67 60 80 40 90 NORMAL
#> # … with 16,401 more rows
