はじめに

PWT: https://www.rug.nl/ggdc/productivity/pwt/?lang=en

Rの初歩: https://oku.edu.mie-u.ac.jp/~okumura/stat/

棒グラフ

library(readxl)
pwt2019 <- read_excel("pwt2019.xlsx")

## 一人あたりGDP
barplot(pwt2019$percapitaGDP,names.arg=pwt2019$countrycode)

## 人口
barplot(pwt2019$pop,names.arg=pwt2019$countrycode)

散布図

RPubsで人口とGDPの散布図を公開。

plot(x, y)

https://oku.edu.mie-u.ac.jp/~okumura/stat/090509b.html

plot(pwt2019$rgdpe,pwt2019$pop)

plot(pwt2019$rgdpe,pwt2019$pop, log="xy")

plot(pwt2019$rgdpe,pwt2019$pop, log="xy", xlab="GDP", ylab="Population")

plot(pwt2019$percapitaGDP,pwt2019$pop, log="xy", xlab="Percapita GDP", ylab="Population")

折れ線グラフ

一人当たりGDPの折れ線グラフ

https://oku.edu.mie-u.ac.jp/~okumura/stat/090503b.html

library(readxl)
pwt1950 <- read_excel("pwt1950.xlsx")
plot(pwt1950$year,pwt1950$percapitaGDP)

plot(pwt1950$year,pwt1950$percapitaGDP,type = "o")

plot(pwt1950$year,pwt1950$percapitaGDP,type = "l")

jpn<-subset(pwt1950,countrycode=="JPN")
plot(jpn$year,jpn$percapitaGDP,type = "o")

library(readxl)
pwt1950 <- read_excel("pwt1950.xlsx")
jpn<-subset(pwt1950,countrycode=="JPN")
usa<-subset(pwt1950,countrycode=="USA")

plot(usa$year,usa$percapitaGDP,type = "o",ylim=c(1000,80000))
points(jpn$year,jpn$percapitaGDP,type = "o")
text(1990,45000,"USA")
text(1990,25000,"JPN")