library(openxlsx) library(ggplot2) library(gridExtra) sample1<-read.xlsx("http://kanggc.iptime.org/book/data/sample1-n.xlsx") year<-sample1$year gdp<-sample1$gdp consumption<-sample1$consumption gdp consumption qp1<-qplot(year, gdp, group=1, geom="line") qp2<-qplot(year, consumption, group=1, geom="line") marrangeGrob(grobs=list(qp1, qp2), nrow=2, ncol=1) plot1<-ggplot(data=sample1, aes(x=year, y=gdp, group=1)) + geom_line() + ggtitle("GDP of Korea(2000-2016)")+ theme(plot.title = element_text(hjust = 0.5)) plot2<-ggplot(data=sample1, aes(x=year, y=consumption, group=1)) + geom_line() + ggtitle("Consumption of Korea(2000-2016)") + theme(plot.title = element_text(hjust = 0.5)) marrangeGrob(grobs=list(plot1, plot2), nrow=2, ncol=1)