View source: R/swimmerplot.h.R
swimmerplot | R Documentation |
Creates a swimmer plot to visualize individual patient timelines and events.
swimmerplot(
data,
patientID,
start,
end,
event,
milestoneVariable,
milestoneTime,
referenceLines = "none",
customReferenceTime = 12,
timetype = "raw",
timetypedata = "ymd",
timetypeoutput = "months",
startType = "relative",
sortVariable,
barHeight = 3
)
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 |
. |
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)
# 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"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.