通过R访问世界银行数据(World Bank Data)分析经济

wbstats 提供了世界银行数据库的数据接口

随着wbstats世界银行数据可以检索和数据功能的几个指标要求。不像WDI,数据返回一个“长”表的所有值和指标单独列一列。此外,功能WB让我指定多少值(MRV)我很感兴趣。

安装

install.packages(‘WDI’)

寻找数据

WDIsearch(‘gdp’)

WDIsearch(‘gdp’)[1:10,] indicator name

[1,] “BG.GSR.NFSV.GD.ZS” “Trade in services (% of GDP)”

[2,] “BM.KLT.DINV.GD.ZS” “Foreign direct investment,
netoutflows (% of GDP)”

[3,] “BN.CAB.XOKA.GD.ZS” “Current account balance (% ofGDP)”

[4,] “BN.CUR.GDPM.ZS” “Currentaccount balance excluding net
officialcapital grants (% of GDP)”

[5,] “BN.GSR.FCTY.CD.ZS” “Net income (% of GDP)”

[6,] “BN.KLT.DINV.CD.ZS” “Foreign direct investment (% of GDP)”

[7,] “BN.KLT.PRVT.GD.ZS” “Private capital flows, total (% ofGDP)”

[8,] “BN.TRF.CURR.CD.ZS” “Net current transfers (% ofGDP)”

[9,] “BNCABFUNDCD_” “CurrentAccount Balance, %GDP”
[10,] “BX.KLT.DINV.WD.GD.ZS” “Foreign direct investment,
net inflows (% of GDP)”

WDIsearch(‘gdp.*capita.*constant’) indicator name
[1,] “GDPPCKD” “GDP per Capita, constant US , m i l l i o n s " [ 2 , ] " N Y . G D P . P C A P . K D " " G D P p e r c a p i t a ( c o n s t a n t 2000 U S ,millions" [2,] "NY.GDP.PCAP.KD" "GDP per capita (constant 2000US ,millions"[2,]"NY.GDP.PCAP.KD""GDPpercapita(constant2000US)”
[3,] “NY.GDP.PCAP.KN” “GDP per capita (constant LCU)”
[4,] “NY.GDP.PCAP.PP.KD” “GDP per capita, PPP (constant 2005 international $)”

下载和使用数据

head(dat) iso2c country NY.GDP.PCAP.KD year1
CN China 9374.883 19602
CN China 9479.824 19613
CN China 9967.366 19624
CN China 10290.362 19635
CN China 10774.653 19646
CN China 11283.606 1965

画图和显示

library(ggplot2)

ggplot(dat,aes(year, NY.GDP.PCAP.KD, color=country)) + geom_line() +

xlab('Year') + ylab('GDP per capita')

原文链接:http://f.dataguru.cn/thread-640636-1-1.html
(出处: 炼数成金)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值