addReferenceLinesProfilePlot: Add reference lines to a profile plot

View source: R/report_addReferenceLinesProfilePlot.R

addReferenceLinesProfilePlotR Documentation

Add reference lines to a profile plot

Description

Add reference lines to a profile plot

Usage

addReferenceLinesProfilePlot(
  gg,
  subjectVar = "USUBJID",
  refLines = NULL,
  refLinesData = NULL,
  refLinesTimeVar = NULL,
  refLinesLabelVar = NULL,
  refLinesColor = "black",
  refLinesLinetype = "dotted",
  timeLim = NULL,
  addLabel = FALSE
)

Arguments

gg

ggplot2 with a subject profile plot for a specific subject (and page) (subset of the output of the subjectProfile[X]Plot)

subjectVar

String, variable of data with subject ID

refLines

(optional) nested list with details for reference line(s). Each sublist contains:

  • (required) 'label': string with label for the reference line

  • (required) 'time': unique time (x) coordinate for the reference line

  • (optional) 'color': color for the reference line, 'black' by default

  • (optional) 'linetype': linetype for the reference line, 'dotted' by default

refLinesData

data.frame with data from which the reference line(s) should be extracted

refLinesTimeVar

string, variable of refLinesData with time for reference line(s)

refLinesLabelVar

string, variable of refLinesData with label for reference line(s)

refLinesColor

vector of length 1 with default color for reference line(s)

refLinesLinetype

vector of length 1 with default linetype for reference line(s)

timeLim

vector of length 2 with time limits. This is used to set the limits to the plot containing the reference lines labels (if requested).

addLabel

logical, if TRUE (FALSE by default) add the label of the reference line(s) at the bottom of the plot

Value

If addLabel is:

  • TRUE: list with:

    • 'gg': ggplot2 plot with reference lines

    • 'ggRefLines': ggplot2 plot containing only the labels at the specified position

  • FALSE: ggplot2 plot with reference lines

Author(s)

Laure Cougnaud


patientProfilesVis documentation built on Nov. 18, 2022, 5:12 p.m.