How subjects move between categories from baseline to follow-up (lab grade shifts, response categories), drawn as a counted tile grid.
geom_shift(mapping = NULL, data = NULL, label = TRUE)A Layer to add with +.
d <- data.frame(
baseline = c("G0", "G0", "G1", "G1", "G2", "G0"),
followup = c("G0", "G1", "G1", "G2", "G2", "G0")
)
ggnext(d, aes(baseline, followup)) + geom_shift()
#> <ggnext plot>
#> data: 6 x 2
#> aes: x = baseline, y = followup
#> layers: 1
#> coord: cartesian
#> mode: static