d2 <- data.frame(
key = letters[c(1, 2, 2)],
value = c(1, 1, 1),
id = LETTERS[c(1, 2, 1)]
)
ggplot(d2, aes(x = key, stratum = value, alluvium = id)) +
geom_alluvium(aes(fill = id)) + geom_stratum()
#> Warning in is_alluvial_lodes(data, key = "x", value = "stratum", id =
#> "alluvium", : Missing id-axis pairings.
#> Warning in is_alluvial_lodes(data, key = "x", value = "stratum", id =
#> "alluvium", : Missing id-axis pairings.
ggplot(d2, aes(x = key, stratum = value, alluvium = id)) +
geom_flow(aes(fill = id)) + geom_stratum()
#> Warning in is_alluvial_lodes(data, key = "x", value = "stratum", id =
#> "alluvium", : Missing id-axis pairings.
#> Warning: Computation failed in `stat_flow()`:
#> all(table(data$alluvium) == 2) is not TRUE
#> Warning in is_alluvial_lodes(data, key = "x", value = "stratum", id =
#> "alluvium", : Missing id-axis pairings.
(They work in a consistent way when NAs are included in the data and na.rm is set to FALSE.) Instead, stat_flow() should remove the ids contributing to each flow that are NA at either end.
stat_alluvium()
makes do when some lodes areNA
or missing, butstat_flow()
gives up when the lodes at two adjacent axes fail to match up exactly:(They work in a consistent way when
NA
s are included in the data andna.rm
is set toFALSE
.) Instead,stat_flow()
should remove theid
s contributing to each flow that areNA
at either end.