Stat_summary in ggplot to calculate the mean without considering the group

I have the following code to generate the plot of the Figure 1 A :
ggplot2(GroupedZScoreFatigue, aes (x = factor(Moment, levels = c("MD-4", "MD-3", "MD-2", "MD-1", "MD", "MD+1", "MD+2")), y = Mean, group = Athlete))+
geom_line(size= 0.2)+
geom_point(size = 2)+
ylab("Fatigue (x̄±σ)")+
xlab("Moment")+
ggtitle("Individual Z-Score Variations - Fatigue")+
theme_classic(base_size = 12)+
theme (legend.position = "None", plot.title = element_text(hjust = 0.5))+
ylim(-2,4)

I want to add a new line to the plot based on the mean of Mean (variable in y axis) for each Moment (variable in x axis), however when i add stat_summary(fun.y=mean, colour="blue", geom="line", size= 0.2) to the code it calculate the mean for each Athlete (variable in group), as shown in Figure 1B. Data may be downloaded here: https://home.mycloud.com/action/share/ae625d4d-46db-44a8-86b7-741eb0a6b6f3

How to solve it? Thank you!

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.