https://github.com/dvrpc/ipd
recreate DVRPC's Indicators of Potential Disadvantage with new data
https://github.com/dvrpc/ipd
Last synced: 5 months ago
JSON representation
recreate DVRPC's Indicators of Potential Disadvantage with new data
- Host: GitHub
- URL: https://github.com/dvrpc/ipd
- Owner: dvrpc
- Created: 2019-01-15T21:39:25.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2025-05-06T19:31:39.000Z (about 1 year ago)
- Last Synced: 2025-05-06T20:34:15.315Z (about 1 year ago)
- Language: R
- Size: 15.1 MB
- Stars: 5
- Watchers: 7
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Indicators of Potential Disadvantage
This project automates DVRPC's Indicators of Potential Disadvantage (IPD) analysis, including data download, processing, and export. For more on IPD analysis, see [Equity Analysis for the Greater Philadelphia Region v2.0](https://www.dvrpc.org/webmaps/ipd/).
## Getting the Code and Software
1. Clone the repository.
2. Download and install R from https://www.r-project.org/
3. Download and install R Studio from https://www.rstudio.com/products/rstudio/#Desktop
## Installing Package Dependencies
The R script has the following dependencies:
- plyr
- here
- sf
- summarytools
- tidycensus
- tidyverse
- tigris
- dplyr
- descr
If you have not previously installed the dependencies, you will need to do so. If you try to run the script without installing the packages, you will get an error message like
`Error in library (name_of_package) : there is no package called 'name_of_package'`.
Install each package from R Studio's console (typically at the bottom of the screen in R Studio) with the command `install.packages('name_of_package')` (include the quotation marks).
## Updating the Script for a New 5-Year Dataset
If you are running the code against a newly released 5-year ACS dataset, do the following:
1. Update the `ipd_year` in the `ipd.r` to be the end year of the dataset.
2. Update the `output_dir` with the output location for the files.
3. Verify the field names (listed under the `# Fields` section). Follow the link provided to check the schema for that dataset.
## Running the Code
1. Open RStudio.
2. Open the R file (File -> Open File)
3. Run the code by clicking the Source button or Ctrl+A followed by Ctrl+Enter.
If you see an error about packages not being installed, see [Installing Package Dependencies](#installing-package-dependencies) above.
Please provide your own API Key (this is required for the `tidycensus` package, not the Census API), you may get another one [here](https://api.census.gov/data/key_signup.html).
### Outputs
After the code has finished, outputs are saved in the /outputs subdirectory of where you cloned the repository on your local machine, including:
- ipd.csv: tract-level statistics and scores for IPD's nine indicators
- ipd.shp: spatial version of ipd.csv
- breaks_by_indicator.csv: bin breaks by indicator
- counts_by_indicator.csv: census tract counts by bin and indicator
- summary_by_indicator.csv: basic summary stats by indicator
- mean_by_county.csv: population-weighted county means by indicator
## Additional Information
- [documentation/discussion.pdf](https://github.com/dvrpc/ipd/blob/master/documentation/discussion.pdf) shows the essential math required to compute IPD scores.
- [documentation/script_reference.pdf](https://github.com/dvrpc/ipd/blob/master/documentation/script_reference.pdf) is a companion document to the script and explains the way the script downloads data and implements IPD analysis, code chunk by code chunk.