View source: R/idb-deprecated.R
idb5 | R Documentation |
(DEPRECATED) Retrieve data from the five-year-age-group IDB dataset.
idb5(
country,
year,
variables = NULL,
concept = NULL,
country_name = FALSE,
api_key = NULL
)
country |
A two-character FIPS code or country name, or a vector of FIPS codes or country names, of the countries for which you'd like to retrieve data. |
year |
A year, or a vector of years, for which you'd like to retrieve data. |
variables |
A vector of variables. Use |
concept |
A concept for which you'd like to retrieve data.
Use |
country_name |
If TRUE, returns a column with the long country name along with the FIPS code. |
api_key |
The user's Census API key. Can be supplied here or set globally in an idbr session with
|
A data frame with the requested data.
https://api.census.gov/data/timeseries/idb/5year.html
## Not run:
# 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')))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.