Created
August 30, 2010 13:41
-
-
Save yutakashino/557416 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
library(WDI) | |
gdp <- WDI(country=c("US","JP","CN"), indicator="NY.GDP.MKTP.CD", start=1960, end=2008) | |
gdppercapita <- WDI(country=c("US","JP","CN"), indicator="NY.GDP.PCAP.CD", start=1960, end=2008) | |
gdpgrowth <- WDI(country=c("US","JP","CN"), indicator="NY.GDP.MKTP.KD.ZG", start=1960, end=2008) | |
ggplot(gdp, aes(year, NY.GDP.MKTP.CD, color=country))+geom_line(stat="identity")+theme_bw()+xlab("Year")+opts(title="GDP (current US$)")+ylab("") | |
ggsave(file='gdp.png') | |
ggplot(gdppercapita, aes(year, NY.GDP.PCAP.CD, color=country))+geom_line(stat="identity")+theme_bw()+xlab("Year")+opts(title="GDP per capita (current US$)")+ylab("") | |
ggsave(file='gdppercapita.png') | |
ggplot(gdpgrowth, aes(year, NY.GDP.MKTP.KD.ZG, color=country))+geom_line(stat="identity")+theme_bw()+xlab("Year")+opts(title="GDP growth (annual %)")+ylab("") | |
ggsave(file='gdpgrowth.png') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment