# NOT RUN {
library(dplyr)
plot_data <- iris %>%
tibble::as_tibble() %>%
mutate(Species = stringr::str_to_sentence(Species))
ggplot_box(plot_data, Species, Petal.Length,
title = "Iris petal length by species",
x_title = "Species",
y_title = "Petal length (cm)")
plot_data <- iris %>%
group_by(Species) %>%
summarise(boxplot_stats = list(rlang::set_names(boxplot.stats(Petal.Length)$stats,
c('ymin','lower','middle','upper','ymax')))) %>%
tidyr::unnest_wider(boxplot_stats)
ggplot_box(plot_data, Species, Petal.Length, stat = "identity")
# }
Run the code above in your browser using DataLab