grouped_ggbarstats | R Documentation |
Helper function for ggstatsplot::ggbarstats
to apply this function across
multiple levels of a given factor and combining the resulting plots using
ggstatsplot::combine_plots
.
grouped_ggbarstats( data, ..., grouping.var, output = "plot", 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. |
output |
Character that describes what is to be returned: can be
|
plotgrid.args |
A |
annotation.args |
A |
For details, see: https://indrajeetpatil.github.io/ggstatsplot/articles/web_only/ggpiestats.html
ggbarstats
, ggpiestats
,
grouped_ggpiestats
# for reproducibility set.seed(123) library(ggstatsplot) library(dplyr, warn.conflicts = FALSE) # let's create a smaller dataframe diamonds_short <- ggplot2::diamonds %>% filter(cut %in% c("Very Good", "Ideal")) %>% filter(clarity %in% c("SI1", "SI2", "VS1", "VS2")) %>% sample_frac(size = 0.05) # plot grouped_ggbarstats( data = diamonds_short, x = color, y = clarity, grouping.var = cut, plotgrid.args = list(nrow = 2) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.