[Solved] How to calculate the mean of a group in R [closed]
[ad_1] Here you go. library(dplyr) Mean_of_a_group <- dataset %>% group_by(age_group) %>% summarize(happy = mean(happy)) I suggest using ggplot2 to do what you want here. ggplot(data = Mean_of_a_group, aes(age_group, happy))+ geom_point Dummy example library(ggplot2) ggplot(aes(x = disp, y= mpg), data = mtcars)+ geom_smooth(aes(colour = “red”), data = mtcars, stat = “smooth”, formula = y ~ x … Read more