Skip to contents

Creates a waterfall plot and analyzes tumor response data following RECIST criteria.

Usage

waterfall2(
  data,
  patientID,
  responseVar,
  timeVar = NULL,
  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 the specified threshold.

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

Display the waterfall plot showing best response for each patient.

showSpiderPlot

Display spider plot showing response trajectories over time (requires time variable).

Value

A results object containing:

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

# \donttest{
data <- data.frame(
    PatientID = paste0("PT", 1:10),
    Response = c(-100, -45, -30, -20, -10, 0, 10, 20, 30, 40),
    Time = c(0, 2, 4, 6, 8, 10, 12, 14, 16, 18)
)
waterfall(
    data = data,
    patientID = "PatientID",
    responseVar = "Response",
    timeVar = "Time"
)
#> 
#>  TREATMENT RESPONSE ANALYSIS
#> 
#>  Response Categories Based on RECIST v1.1 Criteria 
#>  ───────────────────────────────────────────────── 
#>    Category    Number of Patients    Percentage   
#>  ───────────────────────────────────────────────── 
#>    CR     ᵃ                     1           10%   
#>    PR     ᵇ                     2           20%   
#>    SD     ᵈ                     5           50%   
#>    PD     ᵉ                     2           20%   
#>  ───────────────────────────────────────────────── 
#>    ᵃ Complete Response (CR): Complete
#>    disappearance of all target lesions.
#>    ᵇ Partial Response (PR): At least 30%
#>    decrease in sum of target lesions.
#>    ᵈ Stable Disease (SD): Neither PR nor PD
#>    criteria met.
#>    ᵉ Progressive Disease (PD): At least 20%
#>    increase in sum of target lesions.
#> 
#> 
#>  Clinical Response Metrics                    
#>  ──────────────────────────────────────────── 
#>    Metric                             Value   
#>  ──────────────────────────────────────────── 
#>    Objective Response Rate (CR+PR)    30%     
#>    Disease Control Rate (CR+PR+SD)    80%     
#>  ──────────────────────────────────────────── 
#> 
# }