Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
test
library(WDI)
library(ggplot2)
library(googleVis)
library(dplyr)
library("plyr")
pop = WDI(indicator='SP.POP.TOTL', country="all",start=1970, end=2016)
gdp= WDI(indicator='NY.GDP.MKTP.CD', country="all",start=1970, end=2016)
le= WDI(indicator='SP.DYN.LE00.IN', country="all",start=1970, end=2016)
names(pop)[3]="Population"
names(le)[3]="Life Expectancy"
names(gdp)[3]="GDP"
gdp_life_exp <- join(gdp, le)
development <- join(gdp_life_exp,pop)
a =WDI_data
b=a[[1]]
c=a[[2]]
cc = as.data.frame(c)
ff <- cc$region != "Aggregates"
ccc <- cc[ff,]
dd = subset(development, country %in% ccc$country)
ee = join(dd,ccc)
gg<- gvisMotionChart(ee,
idvar = "country",
timevar = "year",
xvar = "GDP",
yvar = "Life Expectancy",
sizevar ="Population",
colorvar = "region")
plot(gg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment