ABSTRACT

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.

Key Features:

  • 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.

part I|54 pages

Introduction

chapter 21|10 pages

A soup to nuts project example

chapter 2|22 pages

Introduction to R and RStudio

chapter 3|12 pages

Data types and structures

chapter 4|8 pages

Reading and writing data

part II|72 pages

Project Management

chapter 565|14 pages

Mise en place

chapter 6|6 pages

Collaboration

chapter 7|16 pages

R Markdown

chapter 8|14 pages

Testing your code

chapter 9|20 pages

Git

part III|92 pages

Clean

chapter 12810|32 pages

Subsetting: Making big things small

chapter 11|22 pages

Exploratory data analysis

chapter 12|24 pages

Regular Expressions

chapter 13|12 pages

Reshaping data

part IV|114 pages

Visualize

chapter 22014|20 pages

Graphing with ggplot2

chapter 15|36 pages

More graphing with ggplot2

chapter 16|16 pages

Hotspot maps

chapter 17|18 pages

Choropleth maps

chapter 18|22 pages

Interactive maps

part V|76 pages

Collect

chapter 33419|8 pages

Webscraping with rvest

chapter 20|6 pages

Functions

chapter 21|6 pages

For loops

chapter 22|18 pages

Scraping tables from PDFs

chapter 23|24 pages

More scraping tables from PDFs

chapter 24|12 pages

Geocoding