I am learning analysis of longitudinal data from the book Longitudinal data Data Analysis for the Behavioral Science using R by Jeffrey Long. On page 123, myX <- scale_x_continuous(breaks = 5:8, name = "Grade") myY <- scale_y_continuous(name = " Reading Score ") g1 <- ggplot(data=MPLS.LS, aes(x=grade, y=read)) + geom_point(shape =1) + myX +myY g2 <- g1 + stat_summary(fun.y = mean, geom = "line", lwd = 1.5, linetype = 5) print(g2) It refused to draw the curve of the means, with an error message: geom_path: Each group consist of only one observation. Do you need to adjust the group aesthetic? But it doesn't give the error message if I used instead g3 <- g1 + stat_summary(fun.y = mean, geom = "point", size=3, shape = 19) print(g3) Any advice would be greatly appreciated. [[alternative HTML version deleted]]