boxplotClinData {clinDataReview}R Documentation

Boxplot interactive plot.

Description

Boxplot interactive plot.

Usage

boxplotClinData(
  data,
  xVar,
  yVar,
  xLab = getLabelVar(xVar, labelVars = labelVars),
  xLabVar = NULL,
  yLab = getLabelVar(yVar, labelVars = labelVars),
  yLabVar = NULL,
  colorVar = NULL,
  colorLab = getLabelVar(colorVar, labelVars = labelVars),
  colorPalette = NULL,
  facetVar = NULL,
  facetLab = getLabelVar(facetVar, labelVars = labelVars),
  ncol = 1L,
  title = paste(c(paste(yLab, "vs", xLab), titleExtra), collapse = "<br>"),
  titleExtra = NULL,
  subtitle = NULL,
  caption = NULL,
  labelVars = NULL,
  width = NULL,
  height = NULL,
  hoverVars,
  hoverLab,
  pathVar = NULL,
  pathLab = getLabelVar(pathVar, labelVars = labelVars),
  idVar = "USUBJID",
  idLab = getLabelVar(idVar, labelVars = labelVars),
  table = FALSE,
  tableVars,
  tableLab,
  tableButton = TRUE,
  tablePars = list(),
  id = paste0("plotClinData", sample.int(n = 1000, size = 1)),
  watermark = NULL,
  verbose = FALSE
)

Arguments

data

Data.frame with data.

xVar

String with column of data containing x-variable.

yVar

String with column of data containing y-variable.

xLab

String with label for xVar.

xLabVar

(optional) Character vector with column(s) of data containing variable(s) to display in the label of the x-axis.

yLab

String with label for xVar.

yLabVar

(optional) Character vector with column(s) of data containing variable(s) to display in the label of the y-axis.

colorVar

(optional) String with color variable.

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.

facetVar

(optional) String with facet variable.

facetLab

String with label for facetVar.

ncol

single-length integer denoting the number of columns for the facetting.

title

String with title for the plot.

titleExtra

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

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, 800 by default.

height

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

hoverVars

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

hoverLab

Named character vector with labels for hoverVars.

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.

idVar

String with variable containing subject ID.

idLab

String with label for idVar.

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.

watermark

(optional) String with path to a file containing a watermark.

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.

Value

Either:

Author(s)

Lennart Tuijnder

See Also

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

Examples

library(clinUtils)

data(dataADaMCDISCP01)
labelVars <- attr(dataADaMCDISCP01, "labelVars")

## example of basic boxplot:

data <- subset(dataADaMCDISCP01$ADVS, 
	PARAMCD == "DIABP" & ANL01FL == "Y" &
	AVISIT %in% c("Baseline", "Week 2", "Week 4", "Week 6", "Week 8")
)

## example of basic boxplot:

# With color var and facet:
boxplotClinData(
	data = data,
	xVar = "AVISIT", 
	yVar = "AVAL",
	colorVar = "TRTA",
	facetVar = "ATPT",
	title = "Diastolic Blood Pressure distribution by actual visit and analysis timepoint",
	yLab = "Actual value of the Diastolic Blood Pressure parameter (mmHg)",
	labelVars = labelVars
)

# Control number of facet columns:
boxplotClinData(
	data = data,
	xVar = "AVISIT", 
	yVar = "AVAL",
	colorVar = "TRTA",
	facetVar = "ATPT",
	ncol = 2,
	title = "Diastolic Blood Pressure distribution by actual visit and analysis timepoint",
	yLab = "Actual value of the Diastolic Blood Pressure parameter (mmHg)",
	labelVars = labelVars
)

## Not run: 

# Facet or color is optional:
boxplotClinData(
	data = data,
	xVar = "AVISIT", 
	yVar = "AVAL",
	colorVar = "TRTA"
)

boxplotClinData(
	data = data,
	xVar = "AVISIT", 
	yVar = "AVAL",
	facetVar = "ATPT"
)

# add caption & subtitle
boxplotClinData(
	data = data,
	xVar = "AVISIT", 
	yVar = "AVAL",
	facetVar = "ATPT", ncol = 2,
	colorVar = "TRTA",
	title = "Diastolic Blood Pressure distribution",
	subtitle = "By actual visit and analysis timepoint",
	yLab = "Actual value of the Diastolic Blood Pressure parameter (mmHg)",
	caption = "Summary statistics are computed internally.",
	labelVars = labelVars
)


## End(Not run)

[Package clinDataReview version 1.6.1 Index]