if (FALSE) {
# World map of infant mortality rates by country for 2016 with plotly
library(idbr)
library(plotly)
library(viridis)
idb_api_key('Your API key goes here')
df <- idb5(country = 'all', year = 2016, variable = 'IMR', country_name = TRUE)
plot_ly(df, z = IMR, text = NAME, locations = NAME, locationmode = 'country names',
type = 'choropleth', colors = viridis(99), hoverinfo = 'text+z') %>%
layout(title = 'Infant mortality rate (per 1000 live births), 2016',
geo = list(projection = list(type = 'robinson')))
}
Run the code above in your browser using DataLab