Description Usage Arguments Value Author(s) Examples
View source: R/derive_var_disposition_status.R
Deprecated, please use derive_var_disposition_status() instead.
Derive a disposition status from the the relevant records in the disposition domain.
| 1 2 3 4 5 6 7 8 9 | derive_disposition_status(
  dataset,
  dataset_ds,
  new_var,
  status_var,
  format_new_var = format_eoxxstt_default,
  filter_ds,
  subject_keys = vars(STUDYID, USUBJID)
)
 | 
| dataset | Input dataset. | 
| dataset_ds | Dataset containing the disposition information (e.g.: ds). It must contain: 
 | 
| new_var | Name of the disposition status variable. A variable name is expected (e.g.  | 
| status_var | The variable used to derive the disposition status. A variable name is expected (e.g.  | 
| format_new_var | The format used to derive the status. Default:  format_eoxxstt_default <- function(x) {
  case_when(
    x == "COMPLETED" ~ "COMPLETED",
    x != "COMPLETED" & !is.na(x) ~ "DISCONTINUED",
    TRUE ~ "ONGOING"
  )
}
where  | 
| filter_ds | Filter condition for the disposition data. one observation per patient. An error is issued otherwise. Permitted Values: logical expression. | 
| subject_keys | Variables to uniquely identify a subject A list of quosures where the expressions are symbols as returned by
 | 
The input dataset with the disposition status (new_var) added.
new_var is derived based on the values given in status_var and according to the format
defined by format_new_var (e.g. when the default format is used, the function will derive
new_var as:
"COMPLETED" if status_var == "COMPLETED",
"DISCONTINUED" if status_var is not "COMPLETED" nor NA,
"ONGOING" otherwise).
Samia Kabi
| 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 42 43 | library(dplyr, warn.conflicts = FALSE)
library(admiral.test)
data("dm")
data("ds")
# Default derivation: EOSSTT =
#- COMPLETED when status_var = COMPLETED
#- DISCONTINUED when status_var is not COMPLETED nor NA
#- ONGOING otherwise
dm %>%
  derive_disposition_status(
    dataset_ds = ds,
    new_var = EOSSTT,
    status_var = DSDECOD,
    filter_ds = DSCAT == "DISPOSITION EVENT"
  ) %>%
  select(STUDYID, USUBJID, EOSSTT)
# Specific derivation: EOSSTT =
#- COMPLETED when status_var = COMPLETED
#- DISCONTINUED DUE TO AE when status_var = ADVERSE EVENT
#- DISCONTINUED NOT DUE TO AE when status_var != ADVERSE EVENT nor COMPLETED nor missing
#- ONGOING otherwise
format_eoxxstt1 <- function(x) {
  case_when(
    x == "COMPLETED" ~ "COMPLETED",
    x == "ADVERSE EVENT" ~ "DISCONTINUED DUE TO AE",
    !(x %in% c("ADVERSE EVENT", "COMPLETED")) & !is.na(x) ~ "DISCONTINUED NOT DUE TO AE",
    TRUE ~ "ONGOING"
  )
}
dm %>%
  derive_disposition_status(
    dataset_ds = ds,
    new_var = EOSSTT,
    status_var = DSDECOD,
    format_new_var = format_eoxxstt1,
    filter_ds = DSCAT == "DISPOSITION EVENT"
  ) %>%
  select(STUDYID, USUBJID, EOSSTT)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.