library(tidyverse)
simple_data <- tibble(
group = factor(rep(c("A", "B"), each = 15)),
subject = 1:30,
score = c(rnorm(15, 40, 20), rnorm(15, 60, 10))
)
simple_data_se <- simple_data %>%
group_by(group) %>%
summarise(mean_se(score))
#> `summarise()` ungrouping output (override with `.groups` argument)
simple_data_se
#> # A tibble: 2 x 4
#> group y ymin ymax
#> <fct> <dbl> <dbl> <dbl>
#> 1 A 40.1 35.9 44.4
#> 2 B 62.6 59.0 66.2
simple_data_se%>%
ggplot(aes(group, y)) +
geom_col() +
geom_errorbar(aes(ymin = ymin, ymax = ymax), width = 0.5)
Created on 2020-09-30 by the reprex package (v0.3.0.9001)