アットウィキロゴ

日本の財政


0.手入力での実施

  •  データセット=「歳出に占める税収の割合(%) 」
    •  source: ttp://www.mof.go.jp/jouhou/syuzei/siryou/003.htm
  • 以下をコピペする。


#歳出に占める税収の割合
(%)
x <- c(67.8,72.1,78.1,81.1,82.7,83.4,86.8,84.8,77.2,72.1,69.3,68.4,66.0,68.7,58.6,53.1,56.8,56.5,52.4,52.5,53.7,57.4,60.2,62.3,52.3,35.9,40.5)
x2 <- ts(x,start=c(1984),frequency=1)
ts.plot(x2,xlab='S59-H22',ylab='税収/歳出',main="歳出に占める税収の割合(%)")

  • グラフが作成される。(容量の関係でアップせず)

1.ファイルを読み込む

  • ファイルを用意する
    • ソース:IMFのWEO2010
    • 入手先:ttp://www.imf.org/external/pubs/ft/weo/2010/01/weodata/index.aspx
    • データを保存し、余計な部分を削りCSVファイル形式で保存。
  • 以下は「Gドライブ>IMF2010(というフォルダ)」に保存した場合。
    • 「x」という名前は上書きされるので注意。
    • 通常は他の名前にする方が良い(が長くなると煩雑なので以下ではxで実施)。
  • 下にあるファイル"JPNfromIMF001.csv"を保存し、以下をコピペする。


x <- read.csv("G:/IMF2010/JPNfromIMF001.csv",skip=1)
GDP <- x[,2]#constant pricesで日本円換算
LB <- x[,3]#General government net lending/borrowingのこと
AB <- x[,4]#Current account balanceのこと

x1 <- ts(GDP, start=c(1980,1),frequency=1)
x2 <- ts(LB, start=c(1980,1),frequency=1)
x3 <- ts(AB, start=c(1980,1),frequency=1)

par(mfrow=c(2,2))#グラフを1画面に導出
ts.plot(x1,xlab='yr',ylab='JPY(Billions)',main="JPN-GDP")
ts.plot(x2,xlab='yr',ylab='JPY',main="Gnrl-gvrnm net lending/borrowinga")
ts.plot(x3,xlab='yr',ylab='Percent of GDP',main="Current account balance")



#個々のグラフを見たいとき #グラフ画面をいったん閉じるかグラフ画面を開いたまま
par(mfrow=c(1,1))#を入力して以下実施
ts.plot(x1,xlab='yr',ylab='JPY(Billions)',main="JPN-GDP")
ts.plot(x2,xlab='yr',ylab='JPY',main="Gnrl-gvrnm net lending/borrowinga")
ts.plot(x3,xlab='yr',ylab='Percent of GDP',main="Current account balance")





最終更新:2010年07月11日 18:49