Beautiful sankey plot
Usage
plot_sankey_single(
data,
pri,
sec,
color.group = c("pri", "sec"),
colors = NULL,
...
)
Examples
ds <- data.frame(g = sample(LETTERS[1:2], 100, TRUE), first = REDCapCAST::as_factor(sample(letters[1:4], 100, TRUE)), last = REDCapCAST::as_factor(sample(letters[1:4], 100, TRUE)))
ds |> plot_sankey_single("first", "last")
#> Loading required package: ggplot2
#> Warning: Some strata appear at multiple axes.
#> Warning: Some strata appear at multiple axes.
#> Warning: Some strata appear at multiple axes.
ds |> plot_sankey_single("first", "last", color.group = "y")
#> Error in match.arg(color.group): 'arg' should be one of “pri”, “sec”
data.frame(
g = sample(LETTERS[1:2], 100, TRUE),
first = REDCapCAST::as_factor(sample(letters[1:4], 100, TRUE)),
last = sample(c(TRUE, FALSE, FALSE), 100, TRUE)
) |>
plot_sankey_single("first", "last", color.group = "pri")