Skip to contents

[Experimental]

This teal module produces a grid style Kaplan-Meier plot for data with ADaM structure.

Usage

tm_g_km(
  label,
  adtte_name,
  mae_name,
  adtte_vars = list(aval = "AVAL", is_event = "is_event", paramcd = "PARAMCD", usubjid =
    "USUBJID", avalu = "AVALU"),
  exclude_assays = "counts",
  summary_funs = list(Mean = colMeans, Median = matrixStats::colMedians, Max =
    matrixStats::colMaxs),
  pre_output = NULL,
  post_output = NULL
)

ui_g_km(
  id,
  datasets,
  adtte_name,
  mae_name,
  summary_funs,
  pre_output,
  post_output
)

srv_g_km(
  id,
  datasets,
  reporter,
  adtte_name,
  mae_name,
  adtte_vars,
  summary_funs,
  exclude_assays
)

sample_tm_g_km()

Arguments

label

(string)
menu item label of the module in the teal app.

adtte_name

(string)
name of the ADTTE dataset.

mae_name

(string)
name of the MAE data used in the teal module.

adtte_vars

(named list of string)
names of the variables to use in the ADTTE dataset. It should comprise elements:

  • aval: the numeric time-to-event variable.

  • avalu: the variable holding the unit of aval.

  • is_event: the logical event variable. It needs to be TRUE when there was an observed event, and FALSE if the time is censored without observed event.

  • paramcd: the character or factor parameter code variable, defining the type of time-to-event for selection in the module.

  • usubjid: the subject ID variable.

exclude_assays

(character)
names of the assays which should not be included in choices in the teal module.

summary_funs

(named list of functions or NULL)
functions which can be used in the the gene signatures. For modules that support also multiple genes without summary, NULL can be included to not summarize the genes but provide all of them.

pre_output

(shiny.tag or NULL)
placed before the output to put the output into context (for example a title).

post_output

(shiny.tag or NULL)
placed after the output to put the output into context (for example the shiny::helpText() elements can be useful).

id

(string) the shiny module id.

datasets

(Datasets)
teal specific argument which is automatically passed to the UI and server functions, holding all the data sets provided in the app initialization.

reporter

(Reporter) object

Value

Shiny module to be used in the teal app.

Functions

  • ui_g_km(): sets up the user interface.

  • srv_g_km(): sets up the user interface.

  • sample_tm_g_km(): sample module function.

Examples

mae <- hermes::multi_assay_experiment
adtte <- scda::synthetic_cdisc_data("rcd_2021_07_07")$adtte %>%
  dplyr::mutate(is_event = (.data$CNSR == 0))

data <- teal_data(
  dataset(
    "ADTTE",
    adtte,
    code = "adtte <- scda::synthetic_cdisc_data('rcd_2021_07_07')$adtte %>%
      dplyr::mutate(is_event = (.data$CNSR == 0))"
  ),
  dataset("MAE", mae)
)

modules <- modules(
  tm_g_km(
    label = "kaplan-meier",
    adtte_name = "ADTTE",
    mae_name = "MAE"
  )
)
#> [INFO] 2022-10-17 14:23:53.7903 pid:2146 token:[] teal.modules.hermes Initializing tm_g_km

app <- init(
  data = data,
  modules = modules
)

if (interactive()) {
  shinyApp(ui = app$ui, server = app$server)
}

# Alternatively you can run the sample module with this function call:
if (interactive()) {
  sample_tm_g_km()
}