Swimmer Plot
Data & Functions


Data for swimmer plots


We use the following datasets: Download datasets

Data should be in the long format (each row is one time point per subject).

base_swimmer_trt base_swimmer_relapsedeath base_swimmer_eventsupp base_swimmer_eval
ID Patient ID ID Patient ID ID Patient ID ID Patient ID
TYPCURE Type of cure event Type of event event Type of event LAMREP Type of response
time Time from diagnosis time Time from diagnosis time Time from diagnosis time Time from diagnosis

ID TYPCURE time
3 no treatment 0.0985626
3 induction 1.0184805
3 no treatment 1.8726899
3 consolidation 2.9568789

ID event time
6 Death 12.911704
10 Relapse 7.359343
10 Relapse 9.889117
10 Death 10.809035

ID time event
6 12.411704 Other event to represent
10 6.859343 Other event to represent
10 9.389117 Other event to represent
10 10.309035 Other event to represent

ID LAMREP time
3 CR 1.839836
3 CR 3.154004
4 CR 0.788501
4 CR 1.412731



Data for Enrollment period plot


We use the following datasets: Download datasets

Data can be in the long format or in the wide format:

base_long base_wide
record_id Trial ID record_id Trial ID
start Start date of enrollment start_exp, start_ctrl Start date of enrollment for exp & ctrl arms
end End date of enrollment end_exp, end_ctrl End date of enrollment for exp & ctrl arms
arm Arm : exp or ctrl
group Group group Group
prim_endp Primary endpoint : Positive/ Negative/ Unclear/ No PE defined prim_endp Primary endpoint : Positive/ Negative/ Unclear/ No PE defined

record_id start end arm group prim_endp
1 2015 2020 exp Balancing-based methods Positive
1 2016 2020 ctrl Balancing-based methods Positive
2 2020 NA exp Balancing-based methods No PE defined
2 2019 2020 ctrl Balancing-based methods No PE defined

record_id start_exp end_exp start_ctrl end_ctrl group prim_endp
1 2015 2020 2016 2020 Balancing-based methods Positive
2 2020 NA 2019 2020 Balancing-based methods No PE defined
3 2017 2020 NA NA Non-balancing methods Positive
4 NA NA 2003 2018 Balancing-based methods Positive



swimmer_plot function


swimmer_plot(
df, a data frame
id = "id", column name for id
end = "end", column name with the bar lengths (or bar end positions if bars change colour)
start = "start", column name with the bar start positions (only required when there are gaps between sections of bars, or bars which do not start at zero)
col, color of the border of the bars
name_fill = NULL, a column name to map the bar fill
name_col = NULL, a column name to map the bar colour
name_alpha = NULL, a column name to map the bar transparency
increasing = TRUE, increasing order (Default is TRUE)
id_order = NULL, order of the bars by id, can input a column name to sort by, or the ids in order
stratify = FALSE, a list of column names to stratify by
base_size = 11, the base size for the plot, default is 11
identifiers = TRUE, binary to specify patient identifiers are included in the y axis (default is TRUE)
...
)

enrollment_period_plot function


Download enrollment_period_plot.R
enrollment_period_plot(
baz_wide = "NULL", data frame in wide format (max one control for one experimental):
- required variables: record_id, start_exp, end_exp, start_ctrl, end_ctrl
- optional variables: group, prim_endp
baz_long = "NULL", data frame in long format:
- required variables: record_id, start, end, arm
- optional variables: group, prim_endp
group_filter = "NULL", character value of group used for filtering
title = "NULL", plot title
subtitle = "NULL", plot subtitle
barwidth = "0.3", bar width (to reduce the width of the bars)
x_lab = "Year", x-axis label
y_lab = "Record ID", y-axis label
)




Contact

This document is a work of the statistics team in the Biostatistics and Medical Information Department at Saint-Louis Hospital in Paris (SBIM).
This site was developed by Emma Lafaurie.
Actual development and updating by Noémie Bigot and Anouk Walter-Petrich
noemie.bigot@aphp.fr; anouk.walter-petrich@u-paris.fr.

Based on The R Graph Gallery by Yan Holtz.

SBIM