Summarise boxplot stats.
Usage
summarise_boxplot_stats(
data,
var,
names_vctr = c("min", "lower", "middle", "upper", "max"),
...
)
Arguments
- data
A data frame. Required input. Group the dataset as appropriate prior.
- var
Unquoted variable from which to calculate boxplot stats. Required input.
- names_vctr
A vector of names for the boxplot stats.
- ...
Passed to
boxplot.stats
Examples
library(simplevis)
library(dplyr)
library(palmerpenguins)
penguins %>%
group_by(species) %>%
summarise_boxplot_stats(body_mass_g)
#> # A tibble: 3 × 6
#> species min lower middle upper max
#> <fct> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 Adelie 2850 3350 3700 4000 4775
#> 2 Chinstrap 2900 3475 3700 3950 4550
#> 3 Gentoo 3950 4700 5000 5500 6300
penguins %>%
group_by(sex, species) %>%
summarise_boxplot_stats(body_mass_g, names_vctr = LETTERS[1:5])
#> # A tibble: 8 × 7
#> sex species A B C D E
#> <fct> <fct> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 female Adelie 2850 3175 3400 3550 3900
#> 2 female Chinstrap 2900 3350 3550 3700 4150
#> 3 female Gentoo 3950 4450 4700 4875 5200
#> 4 male Adelie 3325 3800 4000 4300 4775
#> 5 male Chinstrap 3250 3725 3950 4100 4550
#> 6 male Gentoo 4750 5300 5500 5700 6300
#> 7 NA Adelie 2975 3300 3475 3700 4250
#> 8 NA Gentoo 4100 4375 4688. 4800 4875