diff --git a/NAMESPACE b/NAMESPACE index 3918c56..cf1dc3d 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -7,6 +7,7 @@ export(estimate_zoning_envelope) export(get_box_path) export(get_business_patterns) export(get_current_fire_perimeters) +export(get_disaster_dollar_database) export(get_emergency_management_performance) export(get_fema_disaster_declarations) export(get_government_finances) diff --git a/R/estimate_units_per_parcel.R b/R/estimate_units_per_parcel.R index b06f527..1973945 100644 --- a/R/estimate_units_per_parcel.R +++ b/R/estimate_units_per_parcel.R @@ -133,8 +133,14 @@ benchmark_units_to_census = function(data) { #' \item{residential_unit_categories}{Factor (ordered). Categorical classification of unit counts: "0", "1", "2", "3-4", "5-9", "10-19", "20-49", "50+".} #' \item{median_value_improvement_sf}{Numeric. Tract-level median improvement value for single-family parcels.} #' \item{median_value_improvement_mh}{Numeric. Tract-level median improvement value for manufactured home parcels.} -#' \item{acs_units_*}{Numeric. ACS-reported housing unit counts by units-in-structure category for the tract.} -#' \item{zone, zoned_housing_type, far, setback_*, height_maximum, ...}{Various zoning attributes joined from the zoning dataset.} +#' \item{acs_units_N}{Numeric columns (acs_units_1, acs_units_2, etc.). ACS-reported housing unit counts by units-in-structure category for the tract.} +#' \item{zone}{Character. Zoning designation from the zoning dataset.} +#' \item{zoned_housing_type}{Character. Housing type allowed by zoning.} +#' \item{far}{Numeric. Floor area ratio.} +#' \item{setback_front}{Numeric. Front setback requirement in feet.} +#' \item{setback_rear}{Numeric. Rear setback requirement in feet.} +#' \item{setback_side}{Numeric. Side setback requirement in feet.} +#' \item{height_maximum}{Numeric. Maximum building height allowed.} #' } #' @export estimate_units_per_parcel = function( diff --git a/R/test.R b/R/test.R deleted file mode 100644 index e69de29..0000000 diff --git a/_pkgdown.yml b/_pkgdown.yml index 44e7cb8..422d2ab 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -28,6 +28,7 @@ reference: - title: State data contents: - get_emergency_management_performance + - get_disaster_dollar_database - title: Event boundaries contents: - get_current_fire_perimeters @@ -58,3 +59,4 @@ reference: - read_ipums_cached - inflation_adjust - cache_it + - get_naics_codes diff --git a/man/estimate_units_per_parcel.Rd b/man/estimate_units_per_parcel.Rd index 9634ed1..cd87f3d 100644 --- a/man/estimate_units_per_parcel.Rd +++ b/man/estimate_units_per_parcel.Rd @@ -26,8 +26,14 @@ An \code{sf} object (point geometry, representing parcel centroids) containing t \item{residential_unit_categories}{Factor (ordered). Categorical classification of unit counts: "0", "1", "2", "3-4", "5-9", "10-19", "20-49", "50+".} \item{median_value_improvement_sf}{Numeric. Tract-level median improvement value for single-family parcels.} \item{median_value_improvement_mh}{Numeric. Tract-level median improvement value for manufactured home parcels.} -\item{acs_units_\emph{}{Numeric. ACS-reported housing unit counts by units-in-structure category for the tract.} -\item{zone, zoned_housing_type, far, setback_}, height_maximum, ...}{Various zoning attributes joined from the zoning dataset.} +\item{acs_units_N}{Numeric columns (acs_units_1, acs_units_2, etc.). ACS-reported housing unit counts by units-in-structure category for the tract.} +\item{zone}{Character. Zoning designation from the zoning dataset.} +\item{zoned_housing_type}{Character. Housing type allowed by zoning.} +\item{far}{Numeric. Floor area ratio.} +\item{setback_front}{Numeric. Front setback requirement in feet.} +\item{setback_rear}{Numeric. Rear setback requirement in feet.} +\item{setback_side}{Numeric. Side setback requirement in feet.} +\item{height_maximum}{Numeric. Maximum building height allowed.} } } \description{ diff --git a/man/get_business_patterns.Rd b/man/get_business_patterns.Rd index 3ba7e6d..6794aaa 100644 --- a/man/get_business_patterns.Rd +++ b/man/get_business_patterns.Rd @@ -12,41 +12,47 @@ get_business_patterns( ) } \arguments{ -\item{year}{The vintage of CBP data desired. Data are available from 1986, though -this function likely only supports more recent years (it is tested on 2022-vintage -data only). Default is 2022.} +\item{year}{The vintage of CBP data desired. Data are available from 1986, +though this function likely only supports more recent years (it it tested on 2022-vintage data only). +Default is 2022.} -\item{naics_code_digits}{One of c(2, 3). Default is 2. NAICS codes range in specificity; -2-digit codes describe the highest groupings of industries, while six-digit codes -are exceedingly detailed. There are 20 2-digit NAICS codes and 196 3-digit codes.} +\item{geo}{The level of geography of CBP data desired. Either "county" or "zipcode". Zipcode +level data only The ZIP Code Business Patterns (ZBP) dataset includes the number of establishments, +employment during the week of March 12th, first quarter and annual payroll for NAICS 00 (total for all sectors). +Additionally, the number of establishments (but not employment or payroll) are available by employment +size of the establishment for 2- through 6-digit NAICS.} -\item{naics_codes}{A vector of NAICS codes to query. If NULL, the function will query -all available codes with the specified number of digits. If not NULL, this argument -overrides the \code{naics_code_digits} argument.} +\item{naics_code_digits}{One of c(2, 3). Default is 2. NAICS codes range in +specificity; 2-digit codes describe the highest groupings of industries, +while six-digit codes are exceedingly detailed. There are 20 2-digit NAICS +codes and 196 3-digit codes. If more specific codes are desired, leave this +argument as NULL and supply the desired codes as the argument to \code{naics_codes}.} + +\item{naics_codes}{A vector of NAICS codes to query. If NULL, the function will +query all available codes with the specified number of digits. If not NULL, +this argument overrides the \code{naics_code_digits} argument.} } \value{ A tibble with data on county-level employees, employers, and aggregate -annual payrolls by industry and employer size. Columns include: +annual payrolls by industry and employer size \describe{ -\item{state}{Two-digit state FIPS code.} -\item{county}{Three-digit county FIPS code.} -\item{employees}{Number of employees mid-March of the reference year.} -\item{employers}{Number of establishments.} -\item{annual_payroll}{Annual payroll in thousands of dollars.} -\item{industry}{NAICS industry description (lowercase, underscored).} -\item{employee_size_range_label}{Human-readable employer size category.} -\item{employee_size_range_code}{Census code for employer size range.} +\item{year}{the year for which CBP data is pulled from} +\item{state}{A two-digit state identifier.} +\item{county}{A three-digit county identifier.} +\item{employees}{number of individual employees employed in that particular industry +and establishment size combination} +\item{employers}{number of establishments of each employment size} +\item{annual_payroll}{total annual payroll expenditures measured in $1,000's of USD} +\item{industry}{industry classification according to North American Industry Classification System. +Refer to details for additional information} +\item{employee_size_range_label}{range for the employment size of establishments included in each +given grouping} +\item{employee_size_range_code}{three-digit code used to categorize employment sizes} +\item{naics_code}{two to six-digit code used by the NAICS to categorize and sub-categorize industries} } } \description{ -Retrieves County Business Patterns data from the Census Bureau, -providing counts of establishments, employees, and payroll by industry and -employer size at the county level. -} -\details{ -Data are from the U.S. Census Bureau's County Business Patterns program. -See \url{https://www.census.gov/programs-surveys/cbp.html} and -\url{https://www.census.gov/naics/} for NAICS code definitions. +Obtain County Business Patterns (CBP) Estimates per County } \details{ County Business Patterns (CBP) is an annual series that provides subnational diff --git a/man/get_disaster_dollar_database.Rd b/man/get_disaster_dollar_database.Rd new file mode 100644 index 0000000..b757d1d --- /dev/null +++ b/man/get_disaster_dollar_database.Rd @@ -0,0 +1,28 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/get_disaster_dollar_database.R +\name{get_disaster_dollar_database} +\alias{get_disaster_dollar_database} +\title{Get Disaster Dollar Database Data} +\usage{ +get_disaster_dollar_database( + file_path = file.path(get_box_path(), "hazards", "carnegie-endowment", + "disaster_dollar_database_2025_11_19.csv") +) +} +\arguments{ +\item{file_path}{The path (on Box) to the file containing the raw data.} +} +\value{ +A dataframe comprising disaster-level observations with financial assistance metrics from FEMA's Individual and Households Program (IHP), Public Assistance (PA), HUD's Community Development Block Grant Disaster Recovery (CDBG-DR), and SBA disaster loans. +} +\description{ +Get Disaster Dollar Database Data +} +\details{ +These data are sourced from: https://carnegieendowment.org/features/disaster-dollar-database. The data returned from this function are unchanged, though some columns have been renamed slightly for clarity and consistency. +} +\examples{ +\dontrun{ +get_disaster_dollar_database() +} +} diff --git a/man/get_lodes.Rd b/man/get_lodes.Rd index 14ee347..222d8c9 100644 --- a/man/get_lodes.Rd +++ b/man/get_lodes.Rd @@ -14,13 +14,15 @@ get_lodes( ) } \arguments{ -\item{lodes_type}{One of c("rac", "wac", "od"). "rac" = Residence Area Characteristics, -where jobs are associated with employees' residences. "wac" = Workplace Area Characteristics, -where jobs are associated with employees' workplaces. "od" = Origin-Destination data, -where jobs are associated with both workers' residences and their workplaces.} +\item{lodes_type}{One of c("rac", "wac", "od"). "rac" = Residence Area +Characteristics, where jobs are associated with employees' residences. +"wac" = Workplace Area Characteristics, where jobs are associated with +employees' workplaces. "od" = Origin-Destination data, where jobs are associated +with both workers' residences and their workplaces.} -\item{jobs_type}{One of c("all", "primary"). Default is "all", which includes multiple -jobs for workers with multiple jobs. "primary" includes only the highest-paying job per worker.} +\item{jobs_type}{One of c("all", "primary"). Default is "all", which includes +multiple jobs for workers with multiple jobs. "primary" includes only the +highest-paying job per worker.} \item{states}{A vector of state abbreviations.} @@ -29,37 +31,60 @@ jobs for workers with multiple jobs. "primary" includes only the highest-paying \item{geography}{One of c("block", "block group", "tract", "county", "state"). Default is "tract".} -\item{state_part}{One of c("main", "aux"). Default is "main", which includes only workers -who reside inside the state where they work. "aux" returns only workers who work in the -specified state but live outside of that state.} +\item{state_part}{One of c("main", "aux"). Default is "main", which includes +only workers who reside inside the state where they work. "aux" returns +only workers who work in the specified state but live outside of that state.} } \value{ -A tibble with one record per geography per year per job type. Key columns include: +A tibble with one record per geography per year per job type. Attributes +include total jobs and jobs by worker earnings, industry, and demographics; +the origin-destination results have more limited demographics compared to +the "wac" and "rac" results. \describe{ -\item{year}{Year of the data.} -\item{state}{Two-letter state abbreviation.} -\item{job_type}{"all" or "federal" indicating the job category.} -\item{h_GEOID / w_GEOID}{Home (h) or work (w) GEOID depending on lodes_type.} -\item{jobs}{Total number of jobs.} -\item{jobs_workers_age_29_or_younger}{Jobs for workers age 29 or younger.} -\item{jobs_workers_age_30_to_54}{Jobs for workers age 30 to 54.} -\item{jobs_workers_age_55_or_older}{Jobs for workers age 55 or older.} -\item{jobs_earnings_1250_month_or_less}{Jobs with earnings $1250/month or less.} -\item{jobs_earnings_1251_month_to_3333_month}{Jobs with earnings $1251-$3333/month.} -\item{jobs_earnings_greater_than_3333_month}{Jobs with earnings >$3333/month.} -\item{jobs_industry_\emph{}{Jobs by NAICS industry sector (20 sectors for WAC/RAC).} -\item{jobs_workers_race_}}{Jobs by worker race (WAC/RAC only).} -\item{jobs_workers_ethnicity_\emph{}{Jobs by worker ethnicity (WAC/RAC only).} -\item{jobs_workers_educational_attainment_}}{Jobs by education level (WAC/RAC only).} -\item{jobs_workers_sex_*}{Jobs by worker sex (WAC/RAC only).} +\item{year}{the year for which LODES data is pulled from} +\item{state}{A two-digit state identifier.} +\item{GEOID}{11 digit identifier denoted as either h_GEOID representing the employees' residence census block code or w_GEOID representing the employees' workplace census block code} +\item{job_type}{one of either 'all' jobs or only 'federal' jobs} +\item{total_jobs}{total number of jobs in a given tract} +\item{jobs_workers_age}{number of employees by given age range} +\item{jobs_earnings}{number of employees by given monthly earnings range} +\item{jobs_industry}{number of employees by given industry} +\item{jobs_workers_race}{number of employees by given race, inclusive of hispanic or latino; only available in 'wac' and 'rac' datasets} +\item{jobs_workers_ethnicity}{number of employess by hispanic or latino status, regardless of race; only available in 'wac' and 'rac' datasets} +\item{jobs_workers_educational_attainment}{number of employees by highest level of education attained; only available in 'wac' and 'rac' datasets} +\item{jobs_workers_sex}{number of employees by sex; only available in 'wac' and 'rac' datasets} +\item{jobs_firm_age}{number of employees by the age of employing firm; only available in 'wac' datasets} +\item{jobs_firm_size}{number of employees for a given range in employer size; only available in 'wac' datasets} } } \description{ -Retrieves LODES employment data at various geographic levels. -Returned data are from LODES Version 8, which is enumerated in 2020-vintage geometries. +Get LEHD Origin-Destination Employment Statistics (LODES) data } \details{ -Data are from the Longitudinal Employer-Household Dynamics (LEHD) program. -See \url{https://lehd.ces.census.gov/data/} and the technical documentation at -\url{https://lehd.ces.census.gov/data/lodes/LODES8/LODESTechDoc8.0.pdf}. +The Longitudinal Employer-Household Dynamics (LEHD) data at the U.S. Census Bureau +is a quarterly database of linked employer-employee data covering over 95\% of employment +in the United States. The LEHD data are generated by merging previously collected survey +and administrative data on jobs, businesses, and workers. + +LEHD Origin-Destination Employment Statistics (LODES)is a partially synthetic dataset +that describes geographic patterns of jobs by their employment locations and residential +locations as well as the connections between the two locations. The microdata link employee +and employer data by combining administrative state unemployment insurance wage records +with other administrative and survey data. The source data are aggregated and adjusted +to protect confidentiality. + +LODES data includes three datasets: +Residence Area Characteristics (RAC): +This file lists the total number of jobs by the census block where the employee lives. + +Workplace Area Characteristics (WAC): +This file lists the total number of jobs by the census block where the employee works. + +Origin-Destination (OD): +This file lists job totals by both the census block where the employee lives and the +census block where the employee works + +While similar to County Business Patterns (CBP) data in it's coverage of employment +statistics, LODES differs mainly due to its more granular geographies (tract vs. county) and +focus on framing the statistics at the individual/job level found in LODES data. } diff --git a/man/get_structures.Rd b/man/get_structures.Rd index 729fda8..798559b 100644 --- a/man/get_structures.Rd +++ b/man/get_structures.Rd @@ -14,25 +14,26 @@ get_structures(boundaries, geography = "county", keep_structures = FALSE) \item{keep_structures}{Logical. If TRUE, the raw structure data will be returned alongside the summarized data.} } \value{ -A dataframe comprising estimated counts of each structure type, at the -specified \code{geography}, for all such geographic units intersecting the \code{boundaries} -object. If keep_structure = TRUE, returns a list with two elements: the summarized -data and the raw structure data. Columns include: +Depends on the \code{keep_structures} parameter: + +\strong{When \code{keep_structures = FALSE} (default):} A tibble containing structure counts aggregated by geography and occupancy type, with columns: \describe{ -\item{GEOID}{Census tract (11-digit) or county (5-digit) FIPS code.} -\item{primary_occupancy}{The primary use of the structure (e.g., "Residential", "Commercial").} -\item{occupancy_class}{Broader classification of occupancy type.} -\item{count}{Number of structures of this type in the geographic unit.} +\item{GEOID}{Character. Census geography identifier (county FIPS or tract GEOID depending on \code{geography} parameter).} +\item{primary_occupancy}{Character. The primary occupancy classification of the structures (e.g., "Single Family Dwelling", "Multi - Family Dwelling").} +\item{occupancy_class}{Character. Broad occupancy classification (e.g., "Residential", "Commercial").} +\item{count}{Integer. Number of structures of this occupancy type in the geography.} +} + +\strong{When \code{keep_structures = TRUE}:} A named list with two elements: +\describe{ +\item{structures_summarized}{The aggregated tibble described above.} +\item{structures_raw}{An \code{sf} object (POINT geometry) containing individual structure records with columns: \code{unique_id} (building ID), \code{occupancy_class}, \code{primary_occupancy}, \code{county_fips}, and geometry.} } } \description{ Retrieves building footprint data from the USA Structures dataset and summarizes structure counts by type at the tract or county level. } -\details{ -Data are sourced from the USA Structures dataset maintained by the -Department of Homeland Security. See \url{https://geoplatform.gov/metadata/9d4a3ae3-8637-4707-92a7-b7d67b769a6b}. -} \examples{ \dontrun{ get_structures( diff --git a/vignettes/get_sheldus.Rmd b/vignettes/get_sheldus.Rmd index f8add1b..23f4968 100644 --- a/vignettes/get_sheldus.Rmd +++ b/vignettes/get_sheldus.Rmd @@ -13,10 +13,10 @@ knitr::opts_chunk$set( comment = "#>", warning = FALSE, message = FALSE, + echo = TRUE, fig.width = 8, fig.height = 6, - dpi = 150 -) + dpi = 1000) ``` ## Overview