Skip to contents

Display spider plot as a shiny module

Usage

tm_g_spiderplot(
  label,
  dataname,
  paramcd,
  x_var,
  y_var,
  marker_var,
  line_colorby_var,
  xfacet_var = NULL,
  yfacet_var = NULL,
  vref_line = NULL,
  href_line = NULL,
  anno_txt_var = TRUE,
  legend_on = FALSE,
  plot_height = c(600L, 200L, 2000L),
  plot_width = NULL,
  pre_output = NULL,
  post_output = NULL
)

Arguments

label

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

dataname

(character(1))
analysis data used in the teal module, needs to be available in the list passed to the data argument of teal::init().

paramcd

(character(1) or choices_selected)
variable value designating the studied parameter. See teal.transform::choices_selected() for details.

x_var

x-axis variables

y_var

y-axis variables

marker_var

variable dictates marker symbol

line_colorby_var

variable dictates line color

xfacet_var

variable for x facets

yfacet_var

variable for y facets

vref_line

vertical reference lines

href_line

horizontal reference lines

anno_txt_var

annotation text

legend_on

boolean value for whether legend is displayed

plot_height

(numeric(3))
vector to indicate default value, minimum and maximum values.

plot_width

(numeric(3))
vector to indicate default value, minimum and maximum values.

pre_output

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

post_output

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

Value

the teal::module() object.

Author

Carolyn Zhang (zhanc107) carolyn.zhang@duke.edu

Chendi Liao (liaoc10) chendi.liao@roche.com

Examples


# Example using stream (ADaM) dataset
library(dplyr)
library(scda)
library(nestcolor)

ADSL <- synthetic_cdisc_data("latest")$adsl
ADTR <- synthetic_cdisc_data("latest")$adtr

app <- teal::init(
  data = cdisc_data(
    cdisc_dataset("ADSL", ADSL, code = "ADSL <- synthetic_cdisc_data(\"latest\")$adsl"),
    cdisc_dataset("ADTR", ADTR,
      code = "ADTR <- synthetic_cdisc_data(\"latest\")$adtr",
      keys = c("STUDYID", "USUBJID", "PARAMCD", "AVISIT")
    ),
    check = TRUE
  ),
  modules = modules(
    tm_g_spiderplot(
      label = "Spider plot",
      dataname = "ADTR",
      paramcd = choices_selected(choices = "SLDINV", selected = "SLDINV"),
      x_var = choices_selected(choices = "ADY", selected = "ADY"),
      y_var = choices_selected(choices = c("PCHG", "CHG", "AVAL"), selected = "PCHG"),
      marker_var = choices_selected(choices = c("SEX", "RACE", "USUBJID"), selected = "SEX"),
      line_colorby_var = choices_selected(choices = c("SEX", "USUBJID", "RACE"), selected = "SEX"),
      xfacet_var = choices_selected(choices = c("SEX", "ARM"), selected = "SEX"),
      yfacet_var = choices_selected(choices = c("SEX", "ARM"), selected = "ARM"),
      vref_line = "10, 37",
      href_line = "-20, 0"
    )
  )
)
#> [INFO] 2022-10-19 12:23:57.7049 pid:1898 token:[] teal.osprey Initializing tm_g_spiderplot
if (FALSE) {
shinyApp(app$ui, app$server)
}