Giter Site home page Giter Site logo

renanzg / crime-costs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chipkoziara/crime_costs

0.0 0.0 0.0 14.65 MB

An R script that calculates the total cost of crime for neighborhoods using the RAND Corporation's cost of crime values

R 61.34% HTML 7.14% QML 31.52%

crime-costs's Introduction

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

See a visualization of the R script's output in a web map here, which was built using Mapbox GL JS and Mapbox Studio! You can see the code in the index.html file in this repo.

Cost of Crime for Philadelphia Neighborhoods


_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:

  1. Clone the repo
  2. Run the script from the script's directory with Rscript cost_of_crime.R
  3. Check the output directory for the shapefiles created from the script

Related notes:

The script requires the input directory

The output directory is included for reference

This script is configured to overwrite the contents of output

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.

I also plan to introduce a web-based map that makes it easy to explore this data in the browser. Done! Check it out here or dig into the code in this repo in the index.html file.

Special Thanks I'm using the the City of Philadelphia's open crime data, the RAND Corporation's cost of crime calculator values, and Azavea's excellent Philadelphia neighborhoods shapefile.

crime-costs's People

Contributors

chipkoziara avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.