I need to connect the means for T across time points; and means for M across time points. The T and M have seperate mean and confidence intervals like shown. I tried using the group function but it didn't work as expected. Also, is there anyway to dodge the two groups for each time point?
ab <- rep(c("T","M"), time = 10)
time <- rep(c("J","F"), each = 5)
ab.val <- c(1:20)
df <- data.frame(time,ab,ab.val)
df$ab <- as.factor(df$ab)
df$time <- as.factor(df$time)
ggplot(aes(x= time , y = ab.val, color = ab, group = ab), data = df) +
geom_point() +
stat_summary(fun.data=mean_cl_boot, geom="errorbar", width=0.2, colour="black", aes(group = ab)) +
stat_summary(fun = mean, color = "black", geom ="point", size = 3,show.legend = FALSE, aes(group = ab)) +
geom_line()

