plotCountClinData: Interactive plot of 'count' data

View source: R/plots-countClinData.R

plotCountClinDataR Documentation

Interactive plot of 'count' data

Description

Note: the table and plot are not (yet) linked.

Usage

plotCountClinData(
  data,
  vars,
  varsLab = getLabelVar(vars, labelVars = labelVars),
  valueVar,
  valueLab = getLabelVar(valueVar, labelVars = labelVars),
  colorVar = NULL,
  colorLab = getLabelVar(valueVar, labelVars = labelVars),
  colorPalette = getOption("clinDataReview.colors"),
  colorRange = NULL,
  valueType = "total",
  titleExtra = NULL,
  title = paste(paste(valueLab, "by", paste(varsLab, collapse = " and "), titleExtra),
    collapse = "<br>"),
  subtitle = NULL,
  caption = NULL,
  labelVars = NULL,
  width = NULL,
  height = NULL,
  pathVar = NULL,
  pathLab = getLabelVar(pathVar, labelVars = labelVars),
  hoverVars = c(vars, valueVar, colorVar),
  hoverLab = getLabelVar(hoverVars, labelVars = labelVars),
  table = FALSE,
  tableVars,
  tableLab,
  tableButton = TRUE,
  tablePars = list(),
  id = paste0("plotClinData", sample.int(n = 1000, size = 1)),
  verbose = FALSE,
  typePlot = c("sunburst", "treemap")
)

Arguments

data

Data.frame with data.

vars

Character vector with variables of data containing the groups. If multiple, they should be specified in hierarchical order (from parent to child node).

varsLab

Named character vector with labels for vars.

valueVar

String with numeric variable of data containing the value to display.

valueLab

String with label for the valueVar variable.

colorVar

(optional) String with coloring variable (NULL by default). By default, the treemap is colored based by section.

colorLab

String with label for colorVar.

colorPalette

(optional) Named character vector with color palette. If not specified, the viridis color palette is used.
See clinColors.

colorRange

(optional) Numeric vector of length 2 with range for the color variable, in case it is a numeric variable.

valueType

String with type of values in valueVar (branchvalues of the plot_ly) function), among others: 'total' (default, only if sum(child) <= to parent) or 'relative'.

titleExtra

String with extra title for the plot (appended after title).

title

String with title for the plot.

subtitle

String with subtitle.
The subtitle is included at the top left of the plot, below the title.

caption

String with caption.
The caption is included at the bottom right of the plot. Please note that this might overlap with vertical or rotated x-axis labels.

labelVars

Named character vector containing variable labels.

width

Numeric, width of the plot in pixels, 700 by default.

height

Numeric, height of the plot in pixels, 700 by default.

pathVar

String with variable of data containing hyperlinks with path to the subject-specific report, formatted as:

<a href="./path-to-report">label</a>

.
If multiple, they should be separated by: ', '.
The report(s) will be:

  • compressed to a zip file and downloaded if the user clicks on the 'p' (a.k.a 'profile') key when hovering on a point of the plot

  • included in a collapsible row, and clickable with hyperlinks in the table

pathLab

String with label for pathVar, included in the collapsible row in the table.

hoverVars

Character vector with variable(s) to be displayed in the hover, by default any position and aesthetic variables displayed in the plot.

hoverLab

Named character vector with labels for hoverVars.

table

Logical, if TRUE (FALSE by default) returns also a datatable containing the plot data. (The plot and the table are not linked.)

tableVars

Character vector with variables to be included in the table.

tableLab

Named character vector with labels for each tableVars.

tableButton

Logical, if TRUE (by default) the table is included within an HTML button.

tablePars

List with parameters passed to the getClinDT function.

id

String with general id for the plot:

  • 'id' is used as group for the SharedData

  • 'button:[id]' is used as button ID if table is TRUE

If not specified, a random id, as 'plotClinData[X]' is used.

verbose

Logical, if TRUE (FALSE by default) progress messages are printed in the current console. For the visualizations, progress messages during download of subject-specific report are displayed in the browser console.

typePlot

String with plot type, 'treemap' or 'sunburst'.

Value

Either:

  • if a table is requested: a clinDataReview object, a.k.a a list with the 'plot' (plotly object) and 'table' (datatable object)

  • otherwise: a plotly object

Author(s)

Laure Cougnaud

See Also

Other visualizations of summary statistics for clinical data: barplotClinData(), boxplotClinData(), errorbarClinData(), sunburstClinData(), treemapClinData()


clinDataReview documentation built on March 7, 2023, 5:13 p.m.