Hi. I am trying to code for a scatter plot for three variables in R.
Race= [0,1] YOI= [90,92,94] ASB_mean = [1.56, 1.59, 1.74] Antisocial <- read.csv(file = 'Antisocial.csv') Table_1 <- ddply(Antisocial, "YOI", summarise, ASB_mean = mean(ASB)) Table_1 Race <- unique(Antisocial$Race) Race ggplot(data = Table_1, aes(x = YOI, y = ASB_mean, group_by(Race))) + geom_point(colour = "Black", size = 2) + geom_line(data = Table_1, aes(YOI, ASB_mean), colour = "orange", size = 1)
Can someone help me understand where I am making mistake? I want to plot mean ASB vs YOI grouped by Race. Thanks.