View source: R/ggbetweenstats.R
grouped_ggbetweenstats | R Documentation |
Helper function for ggstatsplot::ggbetweenstats
to apply this function
across multiple levels of a given factor and combining the resulting plots
using ggstatsplot::combine_plots
.
grouped_ggbetweenstats(
data,
...,
grouping.var,
plotgrid.args = list(),
annotation.args = list()
)
data |
A data frame (or a tibble) from which variables specified are to
be taken. Other data types (e.g., matrix,table, array, etc.) will not
be accepted. Additionally, grouped data frames from |
... |
Arguments passed on to
|
grouping.var |
A single grouping variable. |
plotgrid.args |
A |
annotation.args |
A |
ggbetweenstats
, ggwithinstats
,
grouped_ggwithinstats
# for reproducibility
set.seed(123)
library(dplyr, warn.conflicts = FALSE)
library(ggplot2)
grouped_ggbetweenstats(
data = filter(ggplot2::mpg, drv != "4"),
x = year,
y = hwy,
grouping.var = drv
)
# modifying individual plots using `ggplot.component` argument
grouped_ggbetweenstats(
data = filter(
movies_long,
genre %in% c("Action", "Comedy"),
mpaa %in% c("R", "PG")
),
x = genre,
y = rating,
grouping.var = mpaa,
ggplot.component = scale_y_continuous(
breaks = seq(1, 9, 1),
limits = (c(1, 9))
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.