Skip to contents

Set the Values of Admiral Options That Can Be Modified for Advanced Users.

Usage

set_admiral_options(subject_keys, force_admiral_vars)

Arguments

subject_keys

Variables to uniquely identify a subject, defaults to exprs(STUDYID, USUBJID). This option is used as default value for the subject_keys argument in all admiral functions.

force_admiral_vars

If this option is set to TRUE (which is the default), the admiral definition of vars() is forced. This is just a temporary solution to allow running scripts which use vars() in the admiral function calls. It will be removed in a future release.

Value

No return value, called for side effects.

Details

Modify an admiral option, e.g subject_keys, such that it automatically affects downstream function inputs where get_admiral_option() is called such as derive_param_exist_flag().

Examples

library(lubridate)
library(dplyr, warn.conflicts = FALSE)
library(tibble)
set_admiral_options(subject_keys = exprs(STUDYID, USUBJID2))

# Derive a new parameter for measurable disease at baseline
adsl <- tribble(
  ~USUBJID2,
  "1",
  "2",
  "3"
) %>%
  mutate(STUDYID = "XX1234")

tu <- tribble(
  ~USUBJID2, ~VISIT,      ~TUSTRESC,
  "1",       "SCREENING", "TARGET",
  "1",       "WEEK 1",    "TARGET",
  "1",       "WEEK 5",    "TARGET",
  "1",       "WEEK 9",    "NON-TARGET",
  "2",       "SCREENING", "NON-TARGET",
  "2",       "SCREENING", "NON-TARGET"
) %>%
  mutate(
    STUDYID = "XX1234",
    TUTESTCD = "TUMIDENT"
  )

derive_param_exist_flag(
  dataset_adsl = adsl,
  dataset_add = tu,
  filter_add = TUTESTCD == "TUMIDENT" & VISIT == "SCREENING",
  condition = TUSTRESC == "TARGET",
  false_value = "N",
  missing_value = "N",
  set_values_to = exprs(
    PARAMCD = "MDIS",
    PARAM = "Measurable Disease at Baseline"
  )
)
#> # A tibble: 3 x 6
#>   USUBJID2 STUDYID AVALC  AVAL PARAMCD PARAM                         
#>   <chr>    <chr>   <chr> <dbl> <chr>   <chr>                         
#> 1 1        XX1234  Y         1 MDIS    Measurable Disease at Baseline
#> 2 2        XX1234  N         0 MDIS    Measurable Disease at Baseline
#> 3 3        XX1234  N         0 MDIS    Measurable Disease at Baseline