Skip to contents

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

Usage

swimmerplot(
  data,
  patientID,
  start,
  end,
  event,
  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).

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$todoa html
results$summarya table
results$plotan 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

# \donttest{
# 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"
)
#> Error in swimmerplot(data = data, patientID = "PatientID", start = "StartTime",     end = "EndTime", event = "Event"): argument "sortVariable" is missing, with no default
# }