Introduction

You will use this code as a template for your Visualization 3 assignment. The first step is to call a set of packages that you might use in this assignment. The final choices belong to you.

Note that each code chunk is set off with special tags.

library(tidyverse)
library(ggvis)
library(WDI)
library(plotly)

Call package WDI to retrieve most updated figures available.

In this assignment, we need to update 8 data series from the WDI:

Tableau Name WDI Series
Birth Rate SP.DYN.CBRT.IN
Health Exp % GDP SH.XPD.TOTL.ZS
Health Exp/Capita SH.XPD.PCAP
Infant Mortality Rate SP.DYN.IMRT.IN
Internet Usage IT.NET.USER.ZS
Life Expectancy (Total) SP.DYN.LE00.IN
Mobile Phone Usage IT.CEL.SETS.P2
Population Total SP.POP.TOTL

The next code chunk will call the WDI API and fetch the years 2000 through 2017, as available. It will then remove the country regional and other aggregates.

birth <- "SP.DYN.CBRT.IN"
hxpgdp <- "SH.XPD.TOTL.ZS"
hxpcap <- "SH.XPD.PCAP"
infmort <- "SP.DYN.IMRT.IN"
net <-"IT.NET.USER.ZS"
lifeexp <- "SP.DYN.LE00.IN"
mobile <- "IT.CEL.SETS.P2"
pop <- "SP.POP.TOTL"

# create a vector of the desired indicator series
indicators <- c(birth, hxpgdp, hxpcap, infmort, net, lifeexp, mobile, pop)

newdata <- WDI(country="all", indicator = indicators, 
     start = 2000, end = 2017, extra = TRUE)

# remove country groupings
newdata$longitude[newdata$longitude==""] <- NA
countries <- filter(newdata, !is.na(longitude))  # drop aggregate groups
## rename columns for each of reference
countries <- rename(countries, birth = SP.DYN.CBRT.IN, 
       hxpgdp = SH.XPD.TOTL.ZS, hxpcap = SH.XPD.PCAP, 
       infmort = SP.DYN.IMRT.IN, net  = IT.NET.USER.ZS,
       lifeexp = SP.DYN.LE00.IN, mobile = IT.CEL.SETS.P2, 
       pop = SP.POP.TOTL)

glimpse(countries) ## data frame column names appear here
## Observations: 3,775
## Variables: 18
## $ iso2c     <chr> "AD", "AD", "AD", "AD", "AD", "AD", "AD", "AD", "AD"...
## $ country   <chr> "Andorra", "Andorra", "Andorra", "Andorra", "Andorra...
## $ year      <dbl> 2016, 2005, 2000, 2004, 2015, 2014, 2006, 2017, 2002...
## $ birth     <dbl> 8.800, 10.700, 11.300, 10.900, NA, NA, 10.600, NA, 1...
## $ hxpgdp    <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ hxpcap    <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ infmort   <dbl> 3.3, 4.1, 4.7, 4.2, 3.4, 3.5, 4.1, 3.2, 4.5, 3.9, 4....
## $ net       <dbl> 97.93064, 37.60577, 10.53884, 26.83795, 96.91000, 95...
## $ lifeexp   <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
## $ mobile    <dbl> 98.51322, 81.85933, 36.00398, 76.55160, 91.44000, 83...
## $ pop       <dbl> 77281, 78867, 65390, 76244, 78014, 79223, 80991, 769...
## $ iso3c     <fct> AND, AND, AND, AND, AND, AND, AND, AND, AND, AND, AN...
## $ region    <fct> Europe & Central Asia, Europe & Central Asia, Europe...
## $ capital   <fct> Andorra la Vella, Andorra la Vella, Andorra la Vella...
## $ longitude <fct> 1.5218, 1.5218, 1.5218, 1.5218, 1.5218, 1.5218, 1.52...
## $ latitude  <fct> 42.5075, 42.5075, 42.5075, 42.5075, 42.5075, 42.5075...
## $ income    <fct> High income, High income, High income, High income, ...
## $ lending   <fct> Not classified, Not classified, Not classified, Not ...

Population Health Indicators graph (Tableau tab 2)

## Your plotting code goes here

Care Spending 2015 (Tableau tab 3)

## Your plotting code goes here

Technology graph (Tableau tab 4)

## Your plotting code goes here

Conclusion

** write a sentence or two summarizing noteworthy changes in recent years. #####