Skip to content

Instantly share code, notes, and snippets.

@tvganesh
Created September 16, 2016 13:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tvganesh/f7ecfc638b89037fc2e8c7134cb0146e to your computer and use it in GitHub Desktop.
Save tvganesh/f7ecfc638b89037fc2e8c7134cb0146e to your computer and use it in GitHub Desktop.
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