waterfall: Treatment Response Analysis

View source: R/waterfall.h.R

waterfallR Documentation

Treatment Response Analysis

Description

Creates a waterfall plot to visualize tumor response data following RECIST criteria.

Usage

waterfall(
  data,
  patientID,
  responseVar,
  timeVar,
  inputType = "percentage",
  sortBy = "response",
  showThresholds = FALSE,
  labelOutliers = FALSE,
  showMedian = FALSE,
  showCI = FALSE,
  minResponseForLabel = 50,
  colorScheme = "jamovi",
  barAlpha = 1,
  barWidth = 0.7,
  showWaterfallPlot = FALSE,
  showSpiderPlot = FALSE
)

Arguments

data

The data as a data frame.

patientID

Variable containing patient identifiers.

responseVar

Percentage change in tumor size.

timeVar

Time point of measurement for spider plot (e.g., months from baseline)

inputType

Specify data format: 'raw' for actual measurements (will calculate percent change) or 'percentage' for pre-calculated percentage changes

sortBy

Sort the waterfall plot by best response or patient ID.

showThresholds

Show +20 percent and -30 percent RECIST thresholds.

labelOutliers

Label responses exceeding ±50 percent.

showMedian

Show median response as a horizontal line.

showCI

Show confidence interval around median response.

minResponseForLabel

Minimum response value for labels to be displayed.

colorScheme

Color scheme for waterfall plot.

barAlpha

Transparency of bars in waterfall plot.

barWidth

Width of bars in waterfall plot.

showWaterfallPlot

.

showSpiderPlot

Create an additional spider plot showing response over time if longitudinal data available

Value

A results object containing:

results$todo a html
results$todo2 a html
results$summaryTable a table
results$clinicalMetrics a table
results$waterfallplot an image
results$spiderplot an image
results$addResponseCategory an output

Tables can be converted to data frames with asDF or as.data.frame. For example:

results$summaryTable$asDF

as.data.frame(results$summaryTable)

Examples


# data <- data.frame(
#     PatientID = paste0("PT", 1:10),
#     Response = c(-100, -45, -30, -20, -10, 0, 10, 20, 30, 40)
# )
# ClinicoPathDescriptives::waterfall(
#     data = data,
#     patientID = "PatientID",
#     responseVar = "Response"
# )


sbalci/ClinicoPathJamoviModule documentation built on Feb. 25, 2025, 6:34 a.m.