idb5: (DEPRECATED) Retrieve data from the five-year-age-group IDB...

View source: R/idb-deprecated.R

idb5R Documentation

(DEPRECATED) Retrieve data from the five-year-age-group IDB dataset.

Description

(DEPRECATED) Retrieve data from the five-year-age-group IDB dataset.

Usage

idb5(
  country,
  year,
  variables = NULL,
  concept = NULL,
  country_name = FALSE,
  api_key = NULL
)

Arguments

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 idb_variables() for a full list.

concept

A concept for which you'd like to retrieve data. Use idb_concepts() for a list of options.

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 idb_api_key(api_key).

Value

A data frame with the requested data.

See Also

https://api.census.gov/data/timeseries/idb/5year.html

Examples

## 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)

walkerke/IDBr documentation built on Aug. 25, 2023, 11:20 p.m.