Title: | Citizen Voting Age Population |
---|---|
Description: | Works with the Citizen Voting Age Population special tabulation from the US Census Bureau <https://www.census.gov/programs-surveys/decennial-census/about/voting-rights/cvap.html>. Provides tools to download and process raw data. Also provides a downloading interface to processed data. Implements a very basic approach to estimate block level citizen voting age population from block group data. |
Authors: | Christopher T. Kenny [aut, cre]
|
Maintainer: | Christopher T. Kenny <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.5 |
Built: | 2024-08-19 04:32:28 UTC |
Source: | https://github.com/christopherkenny/cvap |
Get Zip File URL for CVAP Special Tabulation Data
cvap_census_url(year = 2022)
cvap_census_url(year = 2022)
year |
numeric. Year for the data in 2009 to 2022. |
string
cvap_census_url()
cvap_census_url()
Assuming citizenship homogeneity within block group race/ethnicity, estimates down from block groups to the block level, proportionally by group if possible, otherwise by total population.
cvap_distribute(cvap, block, wts = "pop", include_implied = TRUE)
cvap_distribute(cvap, block, wts = "pop", include_implied = TRUE)
cvap |
cvap data at the block group level, using default settings of |
block |
block data data for the Census before (or the same as) the year of the cvap data |
wts |
|
include_implied |
logical if a column for the implied total ( |
cvap tibble estimated at the block level
## Not run: # Requires API set up with tidycensus state <- 'DE' cvap <- cvap_get(state, year = 2019) de_block <- censable::build_dec(geography = 'block', state = state, year = 2010, geometry = FALSE) ## End(Not run) # Alternatively, using example data state <- 'DE' cvap <- cvap_get(state, year = 2019) data('de_block') cvap_block <- cvap_distribute(cvap, de_block)
## Not run: # Requires API set up with tidycensus state <- 'DE' cvap <- cvap_get(state, year = 2019) de_block <- censable::build_dec(geography = 'block', state = state, year = 2010, geometry = FALSE) ## End(Not run) # Alternatively, using example data state <- 'DE' cvap <- cvap_get(state, year = 2019) data('de_block') cvap_block <- cvap_distribute(cvap, de_block)
Downloads CVAP, block data, and block group data all together.
Calls cvap_distribute
within.
cvap_distribute_censable( state, year = 2022, clean = TRUE, wts = "pop", include_implied = TRUE )
cvap_distribute_censable( state, year = 2022, clean = TRUE, wts = "pop", include_implied = TRUE )
state |
character. The state to get data for or nation for the nation file. |
year |
numeric. Year for the data in 2009 to 2022. |
clean |
Should variable names be standardized? Default is TRUE. |
wts |
'pop' (default) or 'vap' for the group to distribute by. |
include_implied |
logical if a column for the implied total ( |
cvap tibble estimated at the block level
## Not run: # Requires API set up with tidycensus or censable cvap_distribute_censable('DE', 2019) ## End(Not run)
## Not run: # Requires API set up with tidycensus or censable cvap_distribute_censable('DE', 2019) ## End(Not run)
Downloads processed CVAP data for a state. CVAP data is rounded to the nearest 5 so totals may not sum properly, but will be close.
cvap_get( state, year = 2022, geography = "block group", out_file = NULL, moe = FALSE, clean = TRUE )
cvap_get( state, year = 2022, geography = "block group", out_file = NULL, moe = FALSE, clean = TRUE )
state |
character. The state to get data for or nation for the nation file. |
year |
numeric. Year for the data in 2009 to 2022. |
geography |
character. Level of geography. Default is 'block group'. See Details. |
out_file |
file to save downloaded rds to |
moe |
Include margin of error? Default is FALSE. |
clean |
Should variable names be standardized? Default is TRUE. |
Geography options are
'block group': block group level data
'cd': congressional district data (years 2016+)
'county': county-level data
'place': place-level data
shd': state house district data (years 2016+)
'ssd': state senate district data (years 2016+)
'state': state-level data
'tract': tract-level data
'nation': nation-wide data
tibble of data
cvap_get('DE')
cvap_get('DE')
Get Raw Citizen Voting Age Population Files
cvap_get_raw(url, out_dir)
cvap_get_raw(url, out_dir)
url |
URL to CVAP zip to download. Use |
out_dir |
Directory to unzip to. Defaults to temp directory. |
string, path where the data is saved
# takes 10-20 seconds path <- cvap_get_raw(cvap_census_url())
# takes 10-20 seconds path <- cvap_get_raw(cvap_census_url())
Process Directory of CVAP Files
cvap_process_dir(dir, year, out_dir, moe = TRUE, csv = FALSE)
cvap_process_dir(dir, year, out_dir, moe = TRUE, csv = FALSE)
dir |
Path to directory with the CVAP files |
year |
file year |
out_dir |
directory to create files in |
moe |
Boolean. Default is TRUE. Should margin of error be kept? |
csv |
Boolean. Default is FALSE, which creates an rds file instead. |
list of tibbles of cvap
path <- fs::path_package('cvap', 'extdata') cvap_process_dir(path, year = 2019, out_dir = tempdir())
path <- fs::path_package('cvap', 'extdata') cvap_process_dir(path, year = 2019, out_dir = tempdir())
Process Census CVAP File
cvap_process_file(path, year, out_dir, moe = TRUE, csv = FALSE)
cvap_process_file(path, year, out_dir, moe = TRUE, csv = FALSE)
path |
path to csv file |
year |
file year |
out_dir |
directory to create files in |
moe |
Boolean. Default is TRUE. Should margin of error be kept? |
csv |
Boolean. Default is FALSE, which creates an rds file instead. |
tibble of cvap data
path <- fs::path_package('cvap', 'extdata', 'County.csv') cvap_process_file(path, year = 2019, out_dir = tempdir())
path <- fs::path_package('cvap', 'extdata', 'County.csv') cvap_process_file(path, year = 2019, out_dir = tempdir())
This data set contains block level data for Delaware for 2010.
data("de_block")
data("de_block")
A tibble with population data for Delaware blocks from Census 2010
data(de_block)
data(de_block)
This data set contains block group level data for Delaware for 2019 from the American Community Survey. This is the five year variant (2015-2019).
data("de_block_group")
data("de_block_group")
A tibble with population data for Delaware blocks groups from ACS 2019
data(de_block_group)
data(de_block_group)
Provides a friendlier data format for R for working with VEST crosswalks.
Data can be retallied with PL94171::pl_retally()
using this crosswalk.
vest_crosswalk(state)
vest_crosswalk(state)
state |
character. The state to get the VEST crosswalk for. |
tibble
Amos, Brian, 2021, "2020 Census Block Crosswalk Data", https://doi.org/10.7910/DVN/T9VMJO, Harvard Dataverse, V2
de_cw <- vest_crosswalk('DE')
de_cw <- vest_crosswalk('DE')