Load the required library:

library(WDI)
library(dplyr)
library(tidyr)
library(DT)
library(ggplot2)
library(ggthemes)
library(ggrepel)
library(gganimate)

And see, if need, the info of your session:

devtools::session_info()
##  setting  value                       
##  version  R version 3.4.3 (2017-11-30)
##  system   i686, linux-gnu             
##  ui       X11                         
##  language en_US                       
##  collate  en_US.UTF-8                 
##  tz       Portugal                    
##  date     2018-11-13                  
## 
##  package     * version    date       source                              
##  assertthat    0.2.0      2017-04-11 CRAN (R 3.4.3)                      
##  backports     1.1.2      2017-12-13 CRAN (R 3.4.3)                      
##  base        * 3.4.3      2017-12-29 local                               
##  bindr         0.1.1      2018-03-13 cran (@0.1.1)                       
##  bindrcpp      0.2.2      2018-03-29 cran (@0.2.2)                       
##  colorspace    1.3-2      2016-12-14 CRAN (R 3.4.3)                      
##  compiler      3.4.3      2017-12-29 local                               
##  crayon        1.3.4      2017-09-16 CRAN (R 3.4.3)                      
##  datasets    * 3.4.3      2017-12-29 local                               
##  devtools      1.13.4     2017-11-09 CRAN (R 3.4.3)                      
##  digest        0.6.18     2018-10-10 cran (@0.6.18)                      
##  dplyr       * 0.7.8      2018-11-10 cran (@0.7.8)                       
##  DT          * 0.5        2018-11-05 CRAN (R 3.4.3)                      
##  evaluate      0.10.1     2017-06-24 CRAN (R 3.4.3)                      
##  farver        1.0.0.9999 2018-11-09 Github (thomasp85/farver@5439336)   
##  gganimate   * 0.9.9.9999 2018-11-09 Github (thomasp85/gganimate@cc23618)
##  ggplot2     * 3.1.0.9000 2018-11-12 Github (tidyverse/ggplot2@f5a88a7)  
##  ggrepel     * 0.8.0      2018-05-09 CRAN (R 3.4.3)                      
##  ggthemes    * 3.5.0      2018-05-07 cran (@3.5.0)                       
##  gifski        0.8.6      2018-09-28 cran (@0.8.6)                       
##  glue          1.3.0      2018-07-17 CRAN (R 3.4.3)                      
##  graphics    * 3.4.3      2017-12-29 local                               
##  grDevices   * 3.4.3      2017-12-29 local                               
##  grid          3.4.3      2017-12-29 local                               
##  gtable        0.2.0      2016-02-26 CRAN (R 3.4.3)                      
##  hms           0.4.2      2018-03-10 cran (@0.4.2)                       
##  htmltools     0.3.6      2017-04-28 CRAN (R 3.4.3)                      
##  htmlwidgets   1.3        2018-09-30 cran (@1.3)                         
##  knitr         1.20       2018-02-20 cran (@1.20)                        
##  lazyeval      0.2.1      2017-10-29 CRAN (R 3.4.3)                      
##  magrittr      1.5        2014-11-22 CRAN (R 3.4.3)                      
##  memoise       1.1.0      2017-04-21 CRAN (R 3.4.3)                      
##  methods     * 3.4.3      2017-12-29 local                               
##  munsell       0.5.0      2018-06-12 CRAN (R 3.4.3)                      
##  pillar        1.2.3      2018-05-25 cran (@1.2.3)                       
##  pkgconfig     2.0.2      2018-08-16 cran (@2.0.2)                       
##  plyr          1.8.4      2016-06-08 CRAN (R 3.4.3)                      
##  png           0.1-7      2013-12-03 CRAN (R 3.4.3)                      
##  prettydoc     0.2.1      2018-01-16 CRAN (R 3.4.3)                      
##  prettyunits   1.0.2      2015-07-13 cran (@1.0.2)                       
##  progress      1.2.0      2018-06-14 CRAN (R 3.4.3)                      
##  purrr         0.2.5      2018-05-29 cran (@0.2.5)                       
##  R6            2.3.0      2018-10-04 cran (@2.3.0)                       
##  Rcpp          1.0.0      2018-11-07 cran (@1.0.0)                       
##  RJSONIO     * 1.3-0      2014-07-28 CRAN (R 3.4.3)                      
##  rlang         0.3.0.1    2018-10-25 cran (@0.3.0.1)                     
##  rmarkdown     1.10       2018-06-11 cran (@1.10)                        
##  rprojroot     1.3-2      2018-01-03 cran (@1.3-2)                       
##  scales        1.0.0      2018-08-09 CRAN (R 3.4.3)                      
##  stats       * 3.4.3      2017-12-29 local                               
##  stringi       1.2.4      2018-07-20 cran (@1.2.4)                       
##  stringr       1.3.1      2018-05-10 cran (@1.3.1)                       
##  tibble        1.4.2      2018-01-22 cran (@1.4.2)                       
##  tidyr       * 0.8.2      2018-10-28 cran (@0.8.2)                       
##  tidyselect    0.2.5      2018-10-11 cran (@0.2.5)                       
##  tools         3.4.3      2017-12-29 local                               
##  tweenr        0.1.5.9999 2018-11-09 Github (thomasp85/tweenr@48ea2fd)   
##  utils       * 3.4.3      2017-12-29 local                               
##  WDI         * 2.5        2018-04-10 CRAN (R 3.4.3)                      
##  withr         2.1.2.9000 2018-11-06 Github (jimhester/withr@be57595)    
##  yaml          2.2.0      2018-07-25 cran (@2.2.0)

Search and browse data.worldbank.org

We can search the whole database, for example about mortality:

WDIsearch('mortality')

Usually, it is much convienient if we export the results as a table to view:

WDIsearch('mortality') %>% datatable()

Yes, we are looking for one of the most famous index WD has compiled: How many child loose their within first year. It is a strong indicator of how good the health system is.

url <- "https://www.google.com/search?q=SP.DYN.IMRT.IN+world+bank"
browseURL(url)

Mortality rate, infant (per 1,000 live births)

wb_ind <- "SP.DYN.IMRT.IN" 

wb_data <- WDI(country = c("GR", "PT", "ES"), indicator = "SP.DYN.IMRT.IN", start = 1960)
wb_data %>% datatable()
wb_data <- wb_data %>% 
    rename(value = SP.DYN.IMRT.IN) %>% 
    select(iso2c, country, year, value)

plotting the data with animation:

wb_data %>%
    arrange(country, year) %>% 
    ggplot(aes(x = year, y = value, group = country)) +
    geom_line(aes(colour = country), size = 1.25) +
    geom_segment(aes(xend = 2013, yend = value, colour = country), linetype = 2) +
    geom_point(aes(colour = country), size = 4) + 
    scale_fill_brewer(palette="Spectral") +
    geom_text(aes(x = 2013, label = iso2c, colour = country), hjust = 0, nudge_x = 0.1, 
              size = 6, fontface = "bold") +
    transition_reveal(country, year) +
    theme_wsj() + 
    labs(title = "Infant mortality", subtitle = "number of losses per 1000 live births") +
    xlab("Year") + ylab("mortality") +
    ylim(c(0, 90)) +
    scale_color_discrete(guide = FALSE) +
    theme(text = element_text(size = 14)) 

Education

WDIsearch('education') %>% datatable()
wb_data <- WDI(country = c("GR", "PT", "ES"), indicator = c("SE.TER.ENRL", "SE.TER.GRAD"), start = 1960)
wb_data <- wb_data %>% 
    rename(enrl = SE.TER.ENRL, grad = SE.TER.GRAD) %>% 
    mutate(perc = 100 * grad / enrl) %>% 
    gather(wdi, value, -iso2c, -country, -year)

wb_data %>% 
    filter(wdi != 'perc') %>% 
    ggplot(aes(x = year, y = value, colour = wdi)) +
    geom_line() +
    facet_grid(~country)
## Warning: Removed 2 rows containing missing values (geom_path).

plotting

wb_data %>% 
    filter(wdi == 'perc') %>% 
    ggplot(aes(x = year, y = value, colour = country)) +
    geom_line(size = 2) +
    theme_dark()