Plots can be stratified by any variable in the dataframe like Death and dc :
We will here use the swimmer_plot function and the dataset created in the Data & Function page and the stratify = option.
# Libraries
library(ggplot2)
library(swimplot)#Stratifaction
swim_plot_stratify <-swimmer_plot(df=swimdata,id='SUBJID',start = 0, end='survie',name_fill='Bestrep',
col="black",alpha=0.75,width=.8,base_size = 14,stratify= c('Death','dc')) +
xlab("ID")+
ylab("Time (in days)")
swim_plot_stratify
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.