To add information to the swimmer plot we can use the swimmer points function.
We will here use both swimmer_plot and swimmer_points() functions and the dataset created in the Data & Function page.
# Libraries
library(ggplot2)
library(swimplot)#Swimmer plot with points
swimmer_plot(df=swimdata,id='SUBJID',end='survie',
name_fill='Bestrep',
width=.85)+
xlab("ID")+
ylab("Time (in days)")+
swimmer_points(df_points=swimdata,id="SUBJID",time="survie", name_shape="Death", size=2)
This document is a work by Emma Lafaurie (emma.lafaurie@inserm.fr) for the SBIM (Service de Biostatistique et Information Médicale) at Saint-Louis Hospital in Paris.
Based on the template of Yan Holtz.