Cost of Crime Calculator
An R script that calculates the total cost of crime for neighborhoods using the RAND Corporation's cost of crime values
_This shows the crime type with the greatest cost for each neighborhood in 2015_
What does this R script do? This R script counts the number of crimes in each Philadelphia neighborhood and calculates the cost of each type of crime. Values for the total cost of all crimes per neighborhood, as well as which crime type has the highest cost per neighborhood, are also calculated.
The script outputs two shapefiles, one for neighborhoods and the other for Census block groups.
I've included a QGIS project file with styling (shown above) that highlights the crime type that represents the greatest cost for that polygon.
How can I run this myself? These instructions assume you have R installed:
- Clone the repo
- Run the script from the script's directory with
- Check the
outputdirectory for the shapefiles created from the script
The script requires the
outputdirectory is included for reference
This script is configured to overwrite the contents of
What are next steps? I plan to make it easier to plug in a new city's open crime data and neighborhood shapefile to make this portable to other municipalities.