library(WDI)
## Loading required package: RJSONIO
library(ggplot2)
library(googleVis)
##
## Welcome to googleVis version 0.6.1
##
## Please read the Google API Terms of Use
## before you start using the package:
## https://developers.google.com/terms/
##
## Note, the plot method of googleVis will by default use
## the standard browser to display its output.
##
## See the googleVis package vignettes for more details,
## or visit http://github.com/mages/googleVis.
##
## To suppress this message use:
## suppressPackageStartupMessages(library(googleVis))
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library("plyr")
## -------------------------------------------------------------------------
## You have loaded plyr after dplyr - this is likely to cause problems.
## If you need functions from both plyr and dplyr, please load plyr first, then dplyr:
## library(plyr); library(dplyr)
## -------------------------------------------------------------------------
##
## Attaching package: 'plyr'
## The following objects are masked from 'package:dplyr':
##
## arrange, count, desc, failwith, id, mutate, rename, summarise,
## summarize
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)
## Joining by: iso2c, country, year
development <- join(gdp_life_exp,pop)
## Joining by: iso2c, country, year
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)
## Joining by: iso2c, country
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
gg<- gvisMotionChart(ee,
idvar = "country",
timevar = "year",
xvar = "GDP",
yvar = "Life Expectancy",
sizevar ="Population",
colorvar = "region")
plot(gg)
## starting httpd help server ...
## done
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.