swimmerplot: Swimmer Plot

View source: R/swimmerplot.h.R

swimmerplotR Documentation

Swimmer Plot

Description

Creates a swimmer plot to visualize individual patient timelines and events.

Usage

swimmerplot(
  data,
  patientID,
  start,
  end,
  event,
  milestoneVariable,
  milestoneTime,
  referenceLines = "none",
  customReferenceTime = 12,
  timetype = "raw",
  timetypedata = "ymd",
  timetypeoutput = "months",
  startType = "relative",
  sortVariable,
  barHeight = 3
)

Arguments

data

The data as a data frame.

patientID

Variable containing patient identifiers.

start

Time/date when observation/treatment started.

end

Time/date when observation/treatment ended.

event

Optional variable for event types (e.g., CR, PR, PD).

milestoneVariable

Variable containing milestone events to mark on timeline

milestoneTime

Times when milestones occurred

referenceLines

.

customReferenceTime

.

timetype

Select whether time values are raw numbers or dates

timetypedata

Select the time format in your data

timetypeoutput

Select the time unit for display

startType

Choose whether to align all start times to 0 or use absolute start times

sortVariable

Variable to sort the patient timelines.

barHeight

.

Value

A results object containing:

results$todo a html
results$summary a table
results$plot an image

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

results$summary$asDF

as.data.frame(results$summary)

Examples


# Example will show patient timelines
data <- data.frame(
    PatientID = paste0("PT", 1:10),
    StartTime = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
    EndTime = c(12, 8, 15, 6, 9, 11, 7, 14, 10, 5),
    Event = c("CR", "PD", "PR", "SD", "CR", "PD", "PR", "SD", "CR", "PD")
)
swimmerplot(
    data = data,
    patientID = "PatientID",
    start = "StartTime",
    end = "EndTime",
    event = "Event"
)


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