R coding

Multiple graphs with ggplot

So, I am learning how to use ggplot. Here is one my first attempts and at the same time I discover that you need to use the gridExtra package to layout multiople ggplots. I am using one of my favourite datasets: the Anscombe quartet library(ggplot2) library(grid) library(gridExtra) data(anscombe) The quartet comprises four datasets that have nearly identical simple descriptive statistics, yet appear very different when graphed. p1<-ggplot(anscombe,aes(x1,y1))+geom_point()+geom_smooth(method="lm",se=FALSE,color="red")+xlim(3,16) p2<-ggplot(anscombe,aes(x2,y2))+geom_point()+geom_smooth(method="lm",se=FALSE,color="red")+xlim(3,16) p3<-ggplot(anscombe,aes(x3,y3))+geom_point()+geom_smooth(method="lm",se=FALSE,color="red")+xlim(3,16) p4<-ggplot(anscombe,aes(x4,y4))+geom_point()+geom_smooth(method="lm",se=FALSE,color="red")+xlim(7,20) grid.