formatPlotlyClinData: Format interactive plot, with possibility to download patient...

View source: R/plots-utility-formatPlotlyClinData.R

formatPlotlyClinDataR Documentation

Format interactive plot, with possibility to download patient profiles on a click event.

Description

Format interactive plot, with possibility to download patient profiles on a click event.

Usage

formatPlotlyClinData(
  pl,
  data,
  idVar = "USUBJID",
  pathVar = NULL,
  pathDownload = TRUE,
  idFromDataPlot = FALSE,
  idVarPlot = "key",
  labelVarPlot = NULL,
  highlightOn = "plotly_click",
  highlightOff = "plotly_doubleclick",
  id = paste0("plotClinData", sample.int(n = 1000, size = 1)),
  selectVars = NULL,
  selectLab = getLabelVar(selectVars, labelVars = labelVars),
  keyVar = NULL,
  labelVars = NULL,
  verbose = FALSE
)

Arguments

pl

plotly object.

data

Data.frame with data.

idVar

String with variable of data containing plot element.

pathVar

String with variable of data containing path to a subject-specific report (e.g. patient profiles).

pathDownload

Logical, if TRUE (by default) the subject-specific report(s) are downloaded in a zip compressed file. If FALSE (only available if unique report per idVarPlot), each report is opened in a new window.

idFromDataPlot

Logical, if TRUE (by default) idVarPlot is extracted from the data of the plot output object (e.g. if this plot was created from ggplotly), otherwise directly from the plot object (if the plot was created from plot_ly directly).

idVarPlot

String with variable in the plotly output containing IDs.

labelVarPlot

String with plotly variable used to extract label to build the file name of the zip compressed file containing patient report. If not specified, the label are extracted based on the idVarPlot of the selected plot element.

highlightOn

String with event to turn on the selection (on parameter of highlight), 'plotly_click' by default.

highlightOff

String with event to turn off the selection (off parameter of highlight), 'plotly_doubleclick' by default.

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.

selectVars

(optional) Character vector with variable(s) from data for which a selection box should be included. This enables to select the data displayed in the plot (and associated table).

selectLab

(Named) character vector with label for selectVars.

keyVar

String with unique key variable, identifying unique group for which the link between the table and the plot should be done.

labelVars

Named character vector containing variable labels.

verbose

Logical, if TRUE report progress messages during execution (included in the browser 'Console').

Value

Updated plotly object.

Author(s)

Laure Cougnaud


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