data <- list(a=1000, b=800, c=600, d=400) DiagrammeR::grViz(" digraph graph2 { graph [layout = dot] # node definitions with substituted label text node [shape = rectangle, width = 4, fillcolor = Biege] a [label = '@@1'] b [label = '@@2'] c [label = '@@3'] node [shape = rectangle, width = 2, fillcolor = Biege] d [label = '@@4'] e [label = '@@5'] a -> b -> c [dir=s] a -> d [dir=e] b -> e [dir=e] # c -> f {rank=same; a -> b -> c [dir=s]} } [1]: paste0('All patients in TALOS (n = ', data$a, ')') [2]: paste0('Patients with PASE (n = ', data$b, ')') [3]: paste0('Patients with first event after follow-up (n = ', data$c, ')') [4]: paste0('Excluded due to missing PASE (n = ', data$d, ')') [5]: paste0('Excluded due to early event (n = ', data$d, ')') # [6]: paste0('Excluded due to missing PASE (n = ', data$d, ')') ")