library(openxlsx) sample1<-read.xlsx("http://kanggc.iptime.org/book/data/gdp-q.xlsx") y.ts<-ts(sample1$GDP, start=c(2013,1), frequency=4) y.ts lagy4<-lag(y.ts, k=-4) lagy4 gy4<-(y.ts-lagy4)/lagy4*100 gy4 ly.ts<-log(y.ts) ly.ts gly4<-(ly.ts-lag(ly.ts, k=-4))*100 gly4 plot(gy4, type="l", lwd=3, col="red", main="Exact Growth Rate vs. Approx. Growth Rate of GDP") lines(gly4, lwd=3, lty=6, col="green")