Skip to contents

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$todoa html
results$todo2a html
results$summaryTablea table
results$clinicalMetricsa table
results$waterfallplotan image
results$spiderplotan image
results$addResponseCategoryan output
results$mydataviewa preformatted

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

results$summaryTable$asDF

as.data.frame(results$summaryTable)

Examples

# \donttest{
data <- data.frame(
    PatientID = paste0("PT", 1:10),
    Response = c(-100, -45, -30, -20, -10, 0, 10, 20, 30, 40)
)
waterfall(
    data = data,
    patientID = "PatientID",
    response = "Response"
)
#> Error in waterfall(data = data, patientID = "PatientID", response = "Response"): argument "timeVar" is missing, with no default
# }