Title: | Community Data Explorer for Cincinnati |
---|---|
Description: | This repository serves as the definition of the CoDEC data specifications and provides helpers to create, validate, release, and read CoDEC data. |
Authors: | Cole Brokamp [aut, cre], Erika Manning [aut], Andrew Vancil [aut] |
Maintainer: | Cole Brokamp <[email protected]> |
License: | GPL (>= 3) |
Version: | 2.3.0.9001 |
Built: | 2025-01-24 21:25:57 UTC |
Source: | https://github.com/geomarker-io/codec |
CoDEC Specifications:
The data must include a census tract
identifier column (i.e., census_tract_id_2010
, or census_tract_id_2020
).
The column must contain 11-digit
GEOID
identifiers for every census tract in Hamilton County, OH.
The data includes a year column (year
), an integer year representing the
vintage of the data (e.g. 2021
).
The data can optionally include a month column (month
), an integer month of the year.
Data must be structured in a tidy format such that each row is an observation for a specific census tract at a specific year (and month).
as_codec_dpkg( x, name, version, title = character(), description = character(), homepage = character() ) is_codec_dpkg(x)
as_codec_dpkg( x, name, version, title = character(), description = character(), homepage = character() ) is_codec_dpkg(x)
x |
data.frame or tibble meeting CoDEC data specifications above |
name |
see |
version |
see |
title |
see |
description |
see |
homepage |
see |
for as_codec_dpkg, a dpkg object
for is_codec_dpkg, a logical
is_codec_dpkg(mtcars)
is_codec_dpkg(mtcars)
Read tract and block group ("bg") geographies from the online Census TIGER/Line files into R
cincy_census_geo( geography = c("tract", "bg"), vintage = as.character(2024:2013) ) cincy_county_geo(vintage = as.character(2024:2013))
cincy_census_geo( geography = c("tract", "bg"), vintage = as.character(2024:2013) ) cincy_county_geo(vintage = as.character(2024:2013))
geography |
which type of cincy census geography to return |
vintage |
a character vector of a year corresponding to the vintage of TIGER/Line data |
Compressed shapefiles are downloaded from TIGER into an R user data directory and will be cached
for use across other R sessions (see ?dpkg::stow
for more details).
a simple features object with a geographic identifier column (geoid
)
and a geometry column (s2_geography
)
cincy_census_geo("tract", "2024") cincy_census_geo("tract", "2020") cincy_census_geo("tract", "2019") cincy_census_geo("bg", "2020") cincy_census_geo("bg", "2019") cincy_county_geo("2024")
cincy_census_geo("tract", "2024") cincy_census_geo("tract", "2020") cincy_census_geo("tract", "2019") cincy_census_geo("bg", "2020") cincy_census_geo("bg", "2019") cincy_county_geo("2024")
cincy_city_geo()
cincy_city_geo()
cincy_city_geo()
cincy_city_geo()
cincy_city_geo()
CAGIS data (see install_cagis_data()
) provides community council boundaries, but these boundaries can
overlap and do not align with census geographies or ZIP codes.
By default, the statistical neighborhood approximations are instead returned,
which are calculated by aggregating census tracts into 50 matching neighborhoods.
cincy_neighborhood_geo( geography = c("statistical_neighborhood_approximations", "community_council") )
cincy_neighborhood_geo( geography = c("statistical_neighborhood_approximations", "community_council") )
geography |
which type of cincy neighborhood geography to return |
a simple features object with a geographic identifier column (geoid
)
and a geometry column (s2_geography
)
cincy_neighborhood_geo("statistical_neighborhood_approximations") cincy_neighborhood_geo("community_council")
cincy_neighborhood_geo("statistical_neighborhood_approximations") cincy_neighborhood_geo("community_council")
Read ZIP Code Tabulation Areas (ZCTAs) geographies from the online Census TIGER/Line files into R
cincy_zcta_geo(vintage = as.character(2024:2013))
cincy_zcta_geo(vintage = as.character(2024:2013))
vintage |
a character vector of a year corresponding to the vintage of TIGER/Line data |
a simple features object with a geographic identifier column (geoid
)
and a geometry column (s2_geography
)
cincy_zcta_geo() cincy_zcta_geo("2018")
cincy_zcta_geo() cincy_zcta_geo("2018")
The name of the census tract column in the CoDEC data package is used to add the appropriate cincy geography.
codec_as_sf(x)
codec_as_sf(x)
x |
a CoDEC data package |
Tract identifers do not change across decennial censuses, but the digital representation of their boundaries may be improved over time. Here, data packages using 2010 tract identifers use the TIGER/Line 2019 tract shapefiles and data packages using 2020 tract identifiers use the TIGER/Line 2020 tract shapefiles
a simple features object with a geographic identifier column (geoid
)
and a geometry column (s2_geography
) in addition to the columns in x
codec_as_sf(get_codec_dpkg("property_code_enforcements-v0.2.0"))
codec_as_sf(get_codec_dpkg("property_code_enforcements-v0.2.0"))
CoDEC colors
codec_colors(n = NULL)
codec_colors(n = NULL)
n |
a numeric vector of color numbers or character vector of color names; if NULL returns named vector of available colors |
plot(1:8, rep(1, 8), col = codec_colors(1:8), pch = 19, cex = 10, axes = FALSE, xlab = "", ylab = "") text(1:8, rep(1.1, 8), labels = names(codec_colors()))
plot(1:8, rep(1, 8), col = codec_colors(1:8), pch = 19, cex = 10, axes = FALSE, xlab = "", ylab = "") text(1:8, rep(1.1, 8), labels = names(codec_colors()))
Census block-level weights are used to spatially interpolate CoDEC data packages from the census tract-level to other Cincy geographies.
codec_interpolate(from, to, weights = c("pop", "homes", "area"))
codec_interpolate(from, to, weights = c("pop", "homes", "area"))
from |
a CoDEC data package |
to |
A simple features object returned by one of the |
weights |
which census block-level weights to use; see details |
Block-level total population (pop
), total number of homes (homes
), or total land area (area
)
from the 2020 Census can be chosen to use for the weights.
Geospatial intersection happens after transforming geographies to epsg:5072.
See codec_as_sf()
for adding geography to a CoDEC data package.
Variables beginning with "n_" are interpolated using a weighted sum;
all other variables are interpolated using a weighted mean.
a tibble with a new geographic identifier column for the to
target geography (geoid
)
in addition to the (interpolated) columns in from
codec_interpolate(get_codec_dpkg("acs_measures-v0.1.0"), cincy_neighborhood_geo()) codec_interpolate(get_codec_dpkg("property_code_enforcements-v0.2.0"), cincy_census_geo("tract", "2020"))
codec_interpolate(get_codec_dpkg("acs_measures-v0.1.0"), cincy_neighborhood_geo()) codec_interpolate(get_codec_dpkg("property_code_enforcements-v0.2.0"), cincy_census_geo("tract", "2020"))
Public data packages are downloaded from gh://geomarker-io/codec/
using
dpkg::stow()
to cache a local copy in the user's data directory.
get_codec_dpkg(codec_dpkg, overwrite = FALSE)
get_codec_dpkg(codec_dpkg, overwrite = FALSE)
codec_dpkg |
name of CoDEC dpkg |
overwrite |
logical; re-download the remote file even though a local file with the same name exists? |
a CoDEC data package (see dpkg::as_dpkg()
)
get_codec_dpkg("drivetime-v0.2.2")
get_codec_dpkg("drivetime-v0.2.2")
This installs the CAGIS Open Data GIS database (.gdb
) into the data
directory for the codec package. Once downloaded, it will be reused
across R sessions on the same computer.
The geodatabase contains many
layers that are
updated quarterly. (Historical geodatabases are not available here.)
install_cagis_data( cagis_data_url = "https://www.cagis.org/Opendata/Quarterly_GIS_Data/CAGISOpenDataQ4_2024.gdb.zip" )
install_cagis_data( cagis_data_url = "https://www.cagis.org/Opendata/Quarterly_GIS_Data/CAGISOpenDataQ4_2024.gdb.zip" )
cagis_data_url |
the url to the CAGIS Open Data .gdb.zip file; this changes quarterly, so check for something more recent if the file cannot be found |
This function is called by cincy_neighborhood_geo()
, cincy_city_geo()
and others that import individual layers.
options(timeout = max(2500, getOption("timeout")), download.file.method = "libcurl") install_cagis_data() sf::st_layers(install_cagis_data())$name
options(timeout = max(2500, getOption("timeout")), download.file.method = "libcurl") install_cagis_data() sf::st_layers(install_cagis_data())$name