ggcascade(
.data,
...,
.weights = NULL,
.by = NULL,
.nrow = NULL,
.ncol = NULL,
.add_n = TRUE,
.text_size = 4,
.arrows = TRUE
)
compute_cascade(.data, ..., .weights = NULL, .by = NULL)
plot_cascade(
.data,
.by = NULL,
.nrow = NULL,
.ncol = NULL,
.add_n = TRUE,
.text_size = 4,
.arrows = TRUE
)A data frame, or data frame extension (e.g. a tibble). For
plot_cascade(), the variable displayed on the x-axis should be named
"x" and the number of observations should be named "n", like the
tibble returned by compute_cascade().
<data-masking> Name-value pairs of
conditions defining the different statuses to be plotted (see examples).
<tidy-select> Optional weights.
Should select only one variable.
<tidy-select> A variable or a set
of variables to group by the computation of the cascade, and to generate
facets. To select several variables, use dplyr::pick() (see examples).
Number of rows and columns, for faceted plots.
Display the number of observations?
Size of the labels, passed to ggplot2::geom_text().
Display arrows between statuses?
A ggplot2 plot or a tibble.
ggcascade() calls compute_cascade() to generate a data set passed
to plot_cascade(). Use compute_cascade() and plot_cascade() for
more controls.
ggplot2::diamonds |>
ggcascade(
all = TRUE,
big = carat > .5,
"big & ideal" = carat > .5 & cut == "Ideal"
)
ggplot2::mpg |>
ggcascade(
all = TRUE,
recent = year > 2000,
"recent & economic" = year > 2000 & displ < 3,
.by = cyl,
.ncol = 3,
.arrows = FALSE,
.text_size = 3
)
ggplot2::mpg |>
ggcascade(
all = TRUE,
recent = year > 2000,
"recent & economic" = year > 2000 & displ < 3,
.by = pick(cyl, drv),
.add_n = FALSE,
.text_size = 2
)