if (FALSE) {
# Requires Census Bureau API key
library(data.table)
library(httr2)
library(jsonlite)
library(RcensusPkg)
# 1year wide form, default variables, 2 countries
# (Botswana, Norway)
one_year_dt <- RcensusPkg::get_idb_data(
dataset = "1year",
years = c(2023, 2024),
countries = c("BW", "NO")
)
# 5year long form, all variables, 2023, country = US
five_year_US_long_group_dt <- RcensusPkg::get_idb_data(
dataset = "5year",
years = 2023,
group = TRUE,
countries = "US",
wide_to_long = TRUE
)
}
Run the code above in your browser using DataLab