library(openxlsx) excel_sample1<-read.xlsx("http://kanggc.iptime.org/book/data/sample1-n.xlsx") excel_sample1_dat<- data.matrix(excel_sample1) year<-excel_sample1_dat[,1] gdp<-excel_sample1_dat[,2] consumption<-excel_sample1_dat[,3] data1<-excel_sample1_dat[1:10,] data1 data2<-excel_sample1_dat[11:17,] data2