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)

Arguments

mapping, data

Standard layer overrides. Map the baseline category to x and the follow-up category to y.

label

Annotate cells with counts.

Value

A Layer to add with +.

Examples

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