Untitled
unknown
julia
2 years ago
642 B
5
Indexable
# R code for creating a bar chart with error bars
library(ggplot2)
library(dplyr)
# Calculate mean and standard error of GPA for each group
summary_data <- data %>%
group_by(Athlete) %>%
summarise(mean_GPA = mean(GPA),
se_GPA = sd(GPA) / sqrt(n()))
# Plot bar chart with error bars
ggplot(summary_data, aes(x = Athlete, y = mean_GPA, fill = Athlete)) +
geom_bar(stat = "identity", position = "dodge") +
geom_errorbar(aes(ymin = mean_GPA - se_GPA, ymax = mean_GPA + se_GPA),
width = 0.2, position = position_dodge(0.9)) +
labs(x = "Athlete Status", y = "Mean GPA", title = "Mean GPA by Athlete Status")Editor is loading...
Leave a Comment