library(xts) library(Quandl) T3_1<-Quandl("PIKETTY/T3_1") #並べ替え sortlist <- order(T3_1[,1]) dat <- T3_1[sortlist,] T3_1<-dat rownames(T3_1) <- c(1:nrow(T3_1)) #save("T3_1", file="T3_1.dat") #load("T3_1.dat") ##### T3_1 ##### #1 Year 年 #2 National capital Wn 国民資本 #3 incl. Land 土地 #4 incl. Housing 住宅 #5 incl. Other domestic capital assets その他の国内資本資産 #6 incl. Net foreign capital 純外国資本 #7 Public capital Wg 公的資本 #8 incl. Public assets 公的資産 #9 incl. Public debt 公的債務 #10 Private capital W 民間資本 library(knitr) library(stringr) library("plotrix") library(RColorBrewer) #表 kable(data.frame(year=str_sub(T3_1[,1], start=1, end=4),T3_1[,3:6])) #png("Piketty3_1A.png",width=1000,height=800) stackpoly(T3_1[,3:6],ylim=c(0,800),axis4=F,main="イギリスの資本 1700-2010年", col=c("#FBB4AE","#B3CDE3",rgb(204/255,235/255,197/255,alpha=0.5),"#DECBE4"), xaxlab=str_sub(T3_1[,1], start=1, end=4),border="gray36",staxx=F,stack=TRUE) #boxed.labels(3,180,"土地",border=F,bg=NA,col="gray20") #boxed.labels(4,300,"住宅",border=F,bg=NA,col="gray20") #boxed.labels(4,500,"その他国内資本",border=F,bg=NA,col="gray20") #boxed.labels(5.4,620,"純外国資本",border=F,bg=NA,col="gray20") boxed.labels(c(3,4,4,5.4),c(180,300,500,620),c("土地","住宅","その他国内資本","純外国資本"),border=F,bg=NA,col="gray20",cex=2) #dev.off()
|