A Criminologist's Guide to R
Crime by the Numbers
A Criminologist's Guide to R: Crime by the Numbers introduces the programming language R and covers the necessary skills to conduct quantitative research in criminology. By the end of this book, a person without any prior programming experience can take raw crime data, be able to clean it, visualize the data, present it using R Markdown, and change it to a format ready for analysis. A Criminologist's Guide to R focuses on skills specifically for criminology such as spatial joins, mapping, and scraping data from PDFs, however any social scientist looking for an introduction to R for data analysis will find this useful.
- Introduction to RStudio including how to change user preference settings.
- Basic data exploration and cleaning – subsetting, loading data, regular expressions, aggregating data.
- Graphing with ggplot2.
- How to make maps (hotspot maps, choropleth maps, interactive maps).
- Webscraping and PDF scraping.
- Project management – how to prepare for a project, how to decide which projects to do, best ways to collaborate with people, how to store your code (using git), and how to test your code.
Table of Contents
Chapter 1 A soup to nuts project example
Chapter 2 Introduction to R and Rstudio
Chapter 3 Data types and structures
Chapter 4 Reading and writing Data
Chapter 5 Mise en place
Chapter 6 Collaboration
Chapter 7 R Markdown
Chapter 8 Testing your code
Chapter 9 Git
Chapter 10 Subsetting: Making big things small
Chapter 11 Exploratory data analysis
Chapter 12 Regular Expressions
Chapter 13 Reshaping data
Chapter 14 Graphing with ggplot2
Chapter 15 More graphing with ggplot2
Chapter 16 Hotspot maps
Chapter 17 Choropleth maps
Chapter 18 Interactive maps
Chapter 19 Webscraping with rvest
Chapter 20 Functions
Chapter 21 For Loops
Chapter 22 Scraping tables from PDFs
Chapter 23 More scraping tables from PDFs
Chapter 24 Geocoding
Jacob Kaplan is the Chief Data Scientist of the Research on Policing Reform and Accountability (RoPRA), a multi-disciplinary, multi-institutional team of social scientists studying the feasibility and efficacy of policing reform, with a focus on statistically rigorous research and practical applications. His current appointment is at the Princeton School of Public and International Affairs. He holds a PhD and a master’s degree in criminology from the University of Pennsylvania and a bachelor’s degree in criminal justice from California State University, Sacramento. He is the author of several R packages that make it easier to work with data, including fastDummies and asciiSetupReader. He is also the author of books on the two primary criminal justice data sets: the FBI’s Uniform Crime Reporting (UCR) Program Data, and the FBI’s National Incident Based Reporting System (NIBRS) data.