Skip to contents

[Stable]

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(nestcolor)

ADSL <- osprey::rADSL
ADTR <- osprey::rADTR

app <- teal::init(
  data = cdisc_data(
    cdisc_dataset("ADSL", ADSL, code = "ADSL <- osprey::rADSL"),
    cdisc_dataset("ADTR", ADTR,
      code = "ADTR <- osprey::rADTR",
      keys = c("STUDYID", "USUBJID", "PARAMCD", "AVISIT")
    ),
    check = TRUE
  ),
  modules = modules(
    tm_g_spiderplot(
      label = "Spider plot",
      dataname = "ADTR",
      paramcd = teal.transform::choices_selected(
        choices = "SLDINV",
        selected = "SLDINV"
      ),
      x_var = teal.transform::choices_selected(
        choices = "ADY",
        selected = "ADY"
      ),
      y_var = teal.transform::choices_selected(
        choices = c("PCHG", "CHG", "AVAL"),
        selected = "PCHG"
      ),
      marker_var = teal.transform::choices_selected(
        choices = c("SEX", "RACE", "USUBJID"),
        selected = "SEX"
      ),
      line_colorby_var = teal.transform::choices_selected(
        choices = c("SEX", "USUBJID", "RACE"),
        selected = "SEX"
      ),
      xfacet_var = teal.transform::choices_selected(
        choices = c("SEX", "ARM"),
        selected = "SEX"
      ),
      yfacet_var = teal.transform::choices_selected(
        choices = c("SEX", "ARM"),
        selected = "ARM"
      ),
      vref_line = "10, 37",
      href_line = "-20, 0"
    )
  )
)
#> [INFO] 2023-08-14 13:53:50.1732 pid:1120 token:[] teal.osprey Initializing tm_g_spiderplot
if (interactive()) {
  shinyApp(app$ui, app$server)
}