Dataframe with mean per group and a formatted label for display in ggbetweenstats plot.

mean_labeller(data, x, y, mean.ci = FALSE, k = 3L, ...)

Arguments

data

A dataframe (or a tibble) from which variables specified are to be taken. A matrix or tables will not be accepted.

x

The grouping variable from the dataframe data.

y

The response (a.k.a. outcome or dependent) variable from the dataframe data.

mean.ci

Logical that decides whether 95% confidence interval for mean is to be displayed (Default: FALSE).

k

Number of digits after decimal point (should be an integer) (Default: k = 2).

...

Currently ignored.

Examples

ggstatsplot:::mean_labeller( data = ggplot2::msleep, x = vore, y = brainwt, mean.ci = TRUE, k = 3 )
#> # A tibble: 4 x 4 #> vore brainwt #> <fct> <dbl> #> 1 carni 0.0793 #> 2 herbi 0.622 #> 3 insecti 0.0216 #> 4 omni 0.146 #> label #> <chr> #> 1 list(~italic(widehat(mu))==0.079,CI[95*'%']*'['*0.030,0.140*']') #> 2 list(~italic(widehat(mu))==0.622,CI[95*'%']*'['*0.090,1.315*']') #> 3 list(~italic(widehat(mu))==0.022,CI[95*'%']*'['*0.000,0.054*']') #> 4 list(~italic(widehat(mu))==0.146,CI[95*'%']*'['*0.037,0.309*']') #> n_label #> <chr> #> 1 "carni\n(n = 9)" #> 2 "herbi\n(n = 20)" #> 3 "insecti\n(n = 5)" #> 4 "omni\n(n = 17)"