R/bar_plot.R

Defines functions bar_plot

Documented in bar_plot

#' ggplot2 bar plot
#'
#' @param plot plot where mean is dependent variable
#' @keywords make a ggplot2 bar plot
#' @export
#' @examples
#' plot %>% bar_plot

bar_plot <- function(plot){
  plot +
    geom_bar(stat = "identity", position = "dodge") +
    geom_text(aes(label = round(mean,2)), fontface = "bold", position = position_dodge(0.9), vjust = 3, color="black") +
    geom_errorbar(aes(ymin = lwr, ymax = upr), width = 0.3, size = 1, position = position_dodge(0.9), color = "black", alpha = .95)
}
samuelfranssens/rlibrary documentation built on Nov. 30, 2021, 2:46 a.m.