Skip to content

Instantly share code, notes, and snippets.

@stiles
Last active December 19, 2015 11:49
Show Gist options
  • Save stiles/5950269 to your computer and use it in GitHub Desktop.
Save stiles/5950269 to your computer and use it in GitHub Desktop.
DC crime
#tell R where you're working
setwd("~/YourDataFolder")
#load libraries
library(ggplot2)
library(gdata)
#load data
crime <- read.csv("crime2012.csv")
#see summary statistics by offense
summary(crime$OFFENSE)
#create a new variable for a specific offense
theft <- subset(crime, OFFENSE == "THEFT/OTHER")
#plot the grid with 'facet_wrap'
qplot(HOUR, data = theft, binwidth = 1) + facet_wrap(OFFENSE ~ ANC)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment