# Plotting quantile lines in a scatter plot

#1

I am currently doing a course on data exploration. In that course, I had to draw quantile lines in a scatter plot, joining the points in the scatter plot that denoted a percentage of ‘friend_count’ (say 10%) for different ‘ages’.

For calculating the line joining the means,

``````ggplot(pf,aes(x=age,y=friend_count))+geom_point(alpha=1/20,position=position_jitter(h=0), color='yellow')+xlim(13,90)+coord_trans(y='sqrt')+
+   geom_line(stat = 'summary', fun.y=mean)
``````

this worked perfectly. But for 20% quantile lines, according to the course the code is :

``````ggplot(pf,aes(x=age,y=friend_count))+geom_point(alpha=1/20,position=position_jitter(h=0), color='yellow')+xlim(13,90)+coord_trans(y='sqrt')+
+   geom_line(stat = 'summary', fun.y=mean)+geom_line(stat='summary', fun.y=quantile(pf\$friend_count,probs=0.2) )
``````

However, it shows error message, ‘unknown parameter :probs’

Please try it and tell if I have made any mistake. I checked the documentation of quantile, and probs is a valid parameter.

#2