Description Usage Arguments Examples
View source: R/timeline_plot.R
Takes in wide format
1 2 3 |
d |
Data for events. Data should be formatted such that rows represent different participants and columns are different variables. There must be a column named "id" that contains a unique identifier for each study participant. |
event_vars |
Title of columns containing event timing data to be represented in the figure inputted as a vector. Variables describing event timing data should be formatted as the number of days between study event and time zero on the graph. |
event_labels |
Vector of the labels for the event data in legend. Must be in same order as event_vars. Defaults to event_vars. |
time_interval |
Units for time as seen on the x-axis. Options are "days", "weeks", "years". Default is set to days. |
max_time |
Maximum time plotted. If not specified defaults to maximum seen event time. |
interval_width |
Width of rolling interval for sliding histogram in number of days (even though interval_width is specified in days, it will be reported in whatever units are used for time_interval). |
greyscale |
Plot the figure in greyscale |
custom_xbreaks |
Allows for the additional of customizable breaks on the x-axis. Should be in units specified in "time_interval" (default unit is days). Input as a vector. |
custom_xlabs |
Allows for customizable labels for custom_xbreaks, must match custom_xbreaks in vector length length. |
1 2 3 4 5 6 | timelinePlot(data, event_vars=c("days_to_FU1", "days_to_FU2",
"days_to_disease", "days_to_death"),
event_labels = c("Follow-Up 1", "Follow-Up 2", "Disease Diagnosis", "Death"),
time_interval = "weeks", interval_width=28,
custom_xbreaks = c(0, 52, 104, 156, 208, 260),
custom_xlabs = c("Enrollment", "", "104","", "208", ""))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.