format_reason_default {admiral}R Documentation

Default Format for the Disposition Reason

Description

Define a function to map the disposition reason, to be used as a parameter in derive_vars_disposition_reason().

Usage

format_reason_default(reason, reason_spe = NULL)

Arguments

reason

the disposition variable used for the mapping (e.g. DSDECOD).

reason_spe

the disposition variable used for the mapping of the details if required (e.g. DSTERM).

Details

format_reason_default(DSDECOD) returns DSDECOD when DSDECOD is not 'COMPLETED' nor NA.
format_reason_default(DSDECOD, DSTERM) returns DSTERM when DSDECOD is equal to 'OTHER'.
Usually this function can not be used with ⁠%>%⁠.

Value

A character vector

Author(s)

Samia Kabi

See Also

derive_vars_disposition_reason()

Utilities for Formatting Observations: convert_blanks_to_na(), format_eoxxstt_default(), yn_to_numeric()

Examples

library(dplyr, warn.conflicts = FALSE)
library(admiral.test)
data("admiral_dm")
data("admiral_ds")

# Derive DCSREAS using format_reason_default
admiral_dm %>%
  derive_vars_disposition_reason(
    dataset_ds = admiral_ds,
    new_var = DCSREAS,
    reason_var = DSDECOD,
    format_new_vars = format_reason_default,
    filter_ds = DSCAT == "DISPOSITION EVENT"
  ) %>%
  select(STUDYID, USUBJID, DCSREAS)

[Package admiral version 0.8.4 Index]