library(Quandl) library(xts) TS2_2B<-Quandl("PIKETTY/TS2_2B") sortlist <- order(TS2_2B[,1]) dat <- TS2_2B[sortlist,] TS2_2B<-dat rownames(TS2_2B) <- c(1:nrow(TS2_2B)) Date<-TS2_2B[,1] d0<-TS2_2B[,-1] TS2_2B<-data.frame(Date,d0[order(d0[nrow(d0),], decreasing = TRUE)]) rownames(TS2_2B) <- c(1:nrow(TS2_2B)) library(xts) library(lattice) library(gridExtra) TS2_2B.xts <- as.xts(read.zoo(TS2_2B)) p1<-xyplot(TS2_2B.xts[,c(2,6,8,12,13)],superpose=TRUE,xlab="year",ylab="",main="",lwd=2,grid = TRUE, auto.key=list(title="", space = "top", cex=0.8, columns = 1), scales = list( y = list( rot = 0 )),ylim=c(-1,3)) p2<-xyplot(TS2_2B.xts[,c(1,3,5,10,11)],superpose=TRUE,xlab="year",ylab="",main="Detailed Series of World Population Growth Rate, 1000-2100",lwd=2,grid = TRUE, auto.key=list(title="", space = "top", cex=0.8, columns = 1), scales = list( y = list( rot = 0 )),ylim=c(-1,3)) p3<-xyplot(TS2_2B.xts[,c(4,7,9,14,15)],superpose=TRUE,xlab="year",ylab="",main="",lwd=2,grid = TRUE, auto.key=list(title="", space = "top", cex=0.8, columns = 1), scales = list( y = list( rot = 0 )),ylim=c(-1,3)) grid.arrange(p1,p2,p3,ncol=3)
|