subjectProfileCombine: Combine subject profile plots.

View source: R/report_subjectProfileCombine.R

subjectProfileCombineR Documentation

Combine subject profile plots.

Description

Visualizations of different modules are combined by subject. The plots are aligned in the time axis (if requested). If the plots should be aligned:

  • the same time limits are set for all plots

  • the time axis is transformed if any of the plot was created with a time transformation

  • the time axis is expanded for all plots if any of the plot was created with a time axis expanded.
    The expansion object for the combined plot is created from the max of each expansion element across modules.

If some plots are missing for a specific subject, an empty plot is created, containing information as a text based on the label with which the plot was created.

Usage

subjectProfileCombine(
  listPlots,
  timeLim = NULL,
  timeAlign = "all",
  timeAlignPerSubject = "none",
  subjectVar = "USUBJID",
  maxNLines = NULL,
  refLines = NULL,
  refLinesData = NULL,
  refLinesTimeVar = NULL,
  refLinesLabelVar = NULL,
  shiny = FALSE,
  verbose = FALSE,
  nCores = 1,
  reportPerSubject = FALSE
)

Arguments

listPlots

listPlots per subject as created inside the subjectProfileCombine function.

timeLim

time limits, as returned by the getTimeLimSubjectProfilePlots function.

timeAlign

Character vector with time alignment across modules/subjects, either:

  • 'all' (by default): all plots have the same time limits

  • 'none': each of the plot (module*subject) has its own time limits

  • character vector with names of the modules which should have the same time limits (should correspond to the names of listPlots)

timeAlignPerSubject

Character vector, specifying if the plots should be aligned (or not) across subjects

  • 'none' (by default): all modules to align have the same time limit across subjects

  • 'all': all modules to align have different time limits per subject

  • character vector with subset of the modules to align per subject (should correspond to the names of listPlots)

Only the modules already specified in timeAlign can be aligned by subject.

subjectVar

String, variable of data with subject ID

maxNLines

Maximum number of lines for a combined plot, to fit in the page height.
When the different visualizations are combined for each subject, they will be allocated to different pages if the number of lines of the combined visualization is higher than this number.

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)

shiny

logical, set to TRUE (FALSE by default) if the report is generated from a Shiny application. Messages during report creation will be included in the Shiny interface, and it will be mentioned at the end of the report. In this case, the shiny package should be available.

verbose

logical, if TRUE print messages during execution

nCores

Integer containing the number of cores used for the computation (1 by default). If more than 1, computation is parallelized, in this case the package parallel is required.

reportPerSubject

Logical, if TRUE (FALSE by default) export a subject profile report by subject.

Value

a nested list of ggplot object, containing the combined profile plots across modules for each subject/page.
Each plot object contains in the associated attribute: metaData containing: nLines: an estimation of the number of 'lines' each plot occupies (e.g. to set height of the exported figure).

Author(s)

Laure Cougnaud


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