Skip to contents

This teal module produces grid style Individual patient plot(s) that show trends in parameter values over time for each patient using data with ADaM structure.

Usage

tm_g_ipp(
  label,
  dataname,
  parentname = ifelse(inherits(arm_var, "data_extract_spec"),
    teal.transform::datanames_input(arm_var), "ADSL"),
  arm_var,
  paramcd,
  id_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
    "USUBJID"), "USUBJID", fixed = TRUE),
  visit_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
    "AVISIT"), "AVISIT", fixed = TRUE),
  aval_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
    "AVAL"), "AVAL", fixed = TRUE),
  avalu_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
    "AVALU"), "AVALU", fixed = TRUE),
  base_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
    "BASE"), "BASE", fixed = TRUE),
  add_baseline_hline = FALSE,
  separate_by_obs = FALSE,
  suppress_legend = FALSE,
  add_avalu = TRUE,
  plot_height = c(1200L, 400L, 5000L),
  plot_width = NULL,
  pre_output = NULL,
  post_output = NULL,
  ggplot2_args = teal.widgets::ggplot2_args()
)

Arguments

label

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

dataname

(character)
analysis data used in teal module.

parentname

(character)
parent analysis data used in teal module, usually this refers to ADSL.

arm_var

(teal.transform::choices_selected() or teal.transform::data_extract_spec())
object with all available choices and preselected option for variable values that can be used as arm_var.

paramcd

(character)
variable value designating the studied parameter.

id_var

(character)
the variable name for subject id.

visit_var

(string)
variable name designating the visit timepoint variable.

aval_var

(character)
name of the analysis variable.

avalu_var

(teal.transform::choices_selected() or teal.transform::data_extract_spec())
object with all available choices and preselected option for variable values that can be used as avalu_var.

base_var

(teal.transform::choices_selected() or teal.transform::data_extract_spec())
object with all available choices and preselected option for variable values that can be used as base_var.

add_baseline_hline

(flag)
adds horizontal line at baseline y-value on plot

separate_by_obs

(flag)
creates multi panel plots when TRUE

suppress_legend

(flag)
allow user to suppress legend

add_avalu

(flag)
allow user to not display value unit in the plot.

plot_height

optional, (numeric)
a vector of length three with c(value, min, max). Specifies the height of the main plot and renders a slider on the plot to interactively adjust the plot height.

plot_width

optional, (numeric)
a vector of length three with c(value, min, max). Specifies the width of the main plot and renders a slider on the plot to interactively adjust the plot width.

pre_output

optional, (shiny.tag)
with text placed before the output to put the output into context. For example a title.

post_output

optional, (shiny.tag)
with text placed after the output to put the output into context. For example the shiny::helpText() elements are useful.

ggplot2_args

optional, (ggplot2_args)
object created by teal.widgets::ggplot2_args() with settings for the module plot. For this module, this argument will only accept ggplot2_args object with labs list of following child elements: title, subtitle, x, y. No other elements would be taken into account. The argument is merged with option teal.ggplot2_args and with default module arguments (hard coded in the module body).

For more details, see the vignette: vignette("custom-ggplot2-arguments", package = "teal.widgets").

Examples

library(nestcolor)

adsl <- tmc_ex_adsl %>% dplyr::slice(1:20)
adlb <- tmc_ex_adlb %>% dplyr::filter(USUBJID %in% adsl$USUBJID)

adsl <- df_explicit_na(adsl)
adlb <- df_explicit_na(adlb) %>% dplyr::filter(AVISIT != "SCREENING")

app <- init(
  data = cdisc_data(
    cdisc_dataset("ADSL", adsl),
    cdisc_dataset("ADLB", adlb)
  ),
  modules = modules(
    tm_g_ipp(
      label = "Individual Patient Plot",
      dataname = "ADLB",
      arm_var = choices_selected(
        value_choices(adlb, "ARMCD"),
        "ARM A"
      ),
      paramcd = choices_selected(
        value_choices(adlb, "PARAMCD"),
        "ALT"
      ),
      aval_var = choices_selected(
        variable_choices(adlb, c("AVAL", "CHG")),
        "AVAL"
      ),
      avalu_var = choices_selected(
        variable_choices(adlb, c("AVALU")),
        "AVALU",
        fixed = TRUE
      ),
      id_var = choices_selected(
        variable_choices(adlb, c("USUBJID")),
        "USUBJID",
        fixed = TRUE
      ),
      visit_var = choices_selected(
        variable_choices(adlb, c("AVISIT")),
        "AVISIT"
      ),
      base_var = choices_selected(
        variable_choices(adlb, c("BASE")),
        "BASE",
        fixed = TRUE
      ),
      add_baseline_hline = FALSE,
      separate_by_obs = FALSE
    )
  )
)
#> [INFO] 2023-08-14 14:44:04.8123 pid:1183 token:[] teal.modules.clinical Initializing tm_g_ipp
if (interactive()) {
  shinyApp(ui = app$ui, server = app$server)
}