Title: | Access to Spanish Household Income Distribution Atlas Data |
---|---|
Description: | Provides access to granular socioeconomic indicators from the Spanish Statistical Office (INE) Household Income Distribution Atlas. The package downloads and processes data from a companion 'GitHub' repository (<https://github.com/pablogguz/ineAtlas.data/>) which contains processed versions of the official INE Atlas data. Functions are provided to fetch data at multiple geographic levels (municipalities, districts, and census tracts), including income indicators, demographic characteristics, and inequality metrics. The data repository is updated every year when new releases are published by INE. |
Authors: | Pablo García Guzmán [aut, cre, cph] |
Maintainer: | Pablo García Guzmán <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.3.9000 |
Built: | 2025-03-03 05:50:37 UTC |
Source: | https://github.com/pablogguz/ineatlas |
Downloads and extracts compressed data files from the ineAtlas data repository, providing access to various socioeconomic indicators at different geographic levels.
get_atlas(category, level, cache = TRUE, cache_dir = tempdir())
get_atlas(category, level, cache = TRUE, cache_dir = tempdir())
category |
Character string specifying the data category. Must be one of: "income", "income_sources", "demographics", "distribution_sex", "distribution_sex_age", "distribution_sex_nationality", or "gini_p80p20" |
level |
Character string specifying the geographic level. Must be one of: "municipality", "district", or "tract" |
cache |
Logical indicating whether to cache the extracted data. Default is TRUE. Cached data is stored uncompressed for faster access. |
cache_dir |
Character string specifying the cache directory. Default is tempdir(). |
A tibble containing the requested data. Distribution data will include additional columns for demographic breakdowns (sex, age, nationality). The data is automatically extracted from compressed files and cached locally if requested.
Data files are stored compressed on the repository to reduce size and download times. The function handles decompression automatically.
# Get municipality level income data income_data <- get_atlas("income", "municipality") # Get district level demographics without caching demo_data <- get_atlas("demographics", "district", cache = FALSE) # Get income distribution indicators by sex sex_dist <- get_atlas("distribution_sex", "municipality") # Get inequality indicators including Gini coefficient gini_data <- get_atlas("gini_p80p20", "municipality")
# Get municipality level income data income_data <- get_atlas("income", "municipality") # Get district level demographics without caching demo_data <- get_atlas("demographics", "district", cache = FALSE) # Get income distribution indicators by sex sex_dist <- get_atlas("distribution_sex", "municipality") # Get inequality indicators including Gini coefficient gini_data <- get_atlas("gini_p80p20", "municipality")
Downloads and extracts compressed census data files from the ineAtlas data repository, providing access to detailed demographic, socioeconomic and housing indicators at different geographic levels from the 2021 Population and Housing Census.
get_census(level, cache = TRUE, cache_dir = tempdir())
get_census(level, cache = TRUE, cache_dir = tempdir())
level |
Character string specifying the geographic level. Must be one of: "municipality", "district", or "tract" |
cache |
Logical indicating whether to cache the extracted data. Default is TRUE. Cached data is stored uncompressed for faster access. |
cache_dir |
Character string specifying the cache directory. Default is tempdir(). |
A tibble containing the requested census data at the specified geographic level. The data includes demographic, socioeconomic and housing indicators from the 2021 Population and Housing Census. The data is automatically extracted from compressed files and cached locally if requested.
Data files are stored compressed on the repository to reduce size and download times. The function handles decompression automatically. Census data is only available for 2021.
# Get municipality level census data mun_data <- get_census("municipality") # Get district level census data without caching dist_data <- get_census("district", cache = FALSE) # Get census tract level data tract_data <- get_census("tract")
# Get municipality level census data mun_data <- get_census("municipality") # Get district level census data without caching dist_data <- get_census("district", cache = FALSE) # Get census tract level data tract_data <- get_census("tract")
Downloads and extracts census tract boundary files from the ineAtlas repository, returning an sf object with the geometries for the specified year.
get_tract_geom(year, cache = TRUE, cache_dir = tempdir())
get_tract_geom(year, cache = TRUE, cache_dir = tempdir())
year |
Numeric. Year of the census tract boundaries to retrieve (2015-2022) |
cache |
Logical indicating whether to cache the extracted data. Default is TRUE. Cached data is stored uncompressed for faster access. |
cache_dir |
Character string specifying the cache directory. Default is tempdir(). |
An sf object containing census tract boundaries with the following columns:
year: The reference year
tract_code: Census tract identifier
municipality: Municipality name
province: Province name
geometry: Census tract boundary geometry
# Get census tract boundaries for 2020 tracts_2020 <- get_tract_geom(2020) # Get boundaries without caching tracts_2019 <- get_tract_geom(2019, cache = FALSE)
# Get census tract boundaries for 2020 tracts_2020 <- get_tract_geom(2020) # Get boundaries without caching tracts_2019 <- get_tract_geom(2019, cache = FALSE)