Creates a waterfall plot and analyzes 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 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$todo | a html | ||||
results$todo2 | a html | ||||
results$summaryTable | a table | ||||
results$personTimeTable | 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
# \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
#> ─────────────────────────────────────────────────
#> ─────────────────────────────────────────────────
#>
#>
#> Person-Time Analysis
#> ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
#> Response Category Patients % Patients Person-Time % Time Median Time to Response Median Duration
#> ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
#> ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
#>
#>
#> Clinical Response Metrics
#> ─────────────────────────
#> Metric Value
#> ─────────────────────────
#> ─────────────────────────
#>
# }