Skip to content

Commit

Permalink
Updated to reflect changed source data at data.seattle.gov
Browse files Browse the repository at this point in the history
  • Loading branch information
tkiehne committed Mar 18, 2016
1 parent 4d3c7dc commit 6254ff0
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ vignettes/*.pdf
# Rmd Cache files
*_cache/*

# Data is too large for Github - will be downloaded by script
# Data is too large for Github - will be zipped
*.csv
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

Has the implementation of I-502 (the marijuana legalization initiative of 2012) caused an upsurge of gang crime activity in the Central and South districts of Seattle? We look at the [crime data published by the City of Seattle](https://data.seattle.gov) focusing specifically on the East and South precincts of the city where gang activity is most prevalent.

Data are processed in R and reported via RMarkdown compiled into HTML.
The data originally used in the analysis has been provided in the accompanying zip archive. Due to changes at the souce it is necessary to run this analysis from the provided file. Data are processed in R and reported via RMarkdown compiled into HTML.
Binary file not shown.
38 changes: 33 additions & 5 deletions seattle_crime_2008-2014-reported.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ output:
options(width = 116, scipen = 5, digits = 2)
library(knitr)
opts_chunk$set(comment=NA, fig.width=9, fig.height=6)
library(dplyr, warn.conflicts=F, quietly=T)
library(lattice)
```

## Synopsis
Expand All @@ -23,10 +26,14 @@ Crime data are available from the City of Seattle in a well organized format tha

Data are read directly from the City of Seattle site for processing:

```{r data, cache=TRUE}
library(dplyr, warn.conflicts=F, quietly=T)
```{r data}
# get data
if(!file.exists("Seattle_Police_Department_Police_Report_Incident.csv") &
file.exists("Seattle_Police_Department_Police_Report_Incident.zip"))
{
unzip("Seattle_Police_Department_Police_Report_Incident.zip")
}
if(!file.exists("Seattle_Police_Department_Police_Report_Incident.csv"))
{
download.file("https://data.seattle.gov/api/views/7ais-f98f/rows.csv?accessType=DOWNLOAD", "Seattle_Police_Department_Police_Report_Incident.csv", method="internal", mode="w")
Expand Down Expand Up @@ -59,7 +66,28 @@ Then we filter out all crimes that are not related to violent crimes, weapons, w
```{r datafilter2}
# specific crimes only
crimefilter <- c("ASSLT-AGG-BODYFORCE", "ASSLT-AGG-GUN", "ASSLT-AGG-WEAPON", "ASSLT-OTHER", "DRIVE-BY", "HOMICIDE-JUST-GUN", "HOMICIDE-JUST-WEAPON", "HOMICIDE-NEG-MANS-BODYFORCE", "HOMICIDE-NEG-MANS-GUN", "HOMICIDE-PREMEDITATED-BODYFORC", "HOMICIDE-PREMEDITATED-GUN", "NARC-DISTRIBUTE-HALLUCINOGEN", "NARC-DRUG TRAFFIC LOITERING", "NARC-EQUIPMENT/PARAPHENALIA", "NARC-FORGERY-PRESCRIPTION", "NARC-FOUND-AMPHETAMINE", "NARC-FOUND-COCAINE", "NARC-FOUND-HALLUCINOGEN", "NARC-FOUND-HEROIN", "NARC-FOUND-METH", "NARC-FOUND-OPIUM", "NARC-FOUND-PILL/TABLET", "NARC-FOUND-SYNTHETIC", "NARC-FRAUD-PRESCRIPTION", "NARC-MANUFACTURE-HALLUCINOGEN", "NARC-MANUFACTURE-OTHER", "NARC-POSSESS-AMPHETAMINE", "NARC-POSSESS-BARBITUATE", "NARC-POSSESS-COCAINE", "NARC-POSSESS-HALLUCINOGEN", "NARC-POSSESS-HEROIN", "NARC-POSSESS-METH", "NARC-POSSESS-OPIUM", "NARC-POSSESS-PILL/TABLET", "NARC-POSSESS-PRESCRIPTION", "NARC-POSSESS-SYNTHETIC", "NARC-SELL-AMPHETAMINE", "NARC-SELL-BARBITUATE", "NARC-SELL-COCAINE", "NARC-SELL-HALLUCINOGEN", "NARC-SELL-HEROIN", "NARC-SELL-METH", "NARC-SELL-OPIUM", "NARC-SELL-PILL/TABLET", "NARC-SELL-PRESCRIPTION", "NARC-SELL-SYNTHETIC", "NARC-SMUGGLE-COCAINE", "NARC-SMUGGLE-METH", "NARC-SMUGGLE-OTHER", "ROBBERY-RESIDENCE-GUN", "ROBBERY-RESIDENCE-WEAPON", "ROBBERY-STREET-BODYFORCE", "ROBBERY-STREET-GUN", "ROBBERY-STREET-WEAPON", "THREATS-KILL", "THREATS-OTHER", "THREATS-WEAPON", "WEAPON-CONCEALED", "WEAPON-DISCHARGE", "WEAPON-POSSESSION", "WEAPON-SELLING", "WEAPON-SURRENDER-EXCLUDING FIR", "WEAPON-UNLAWFUL USE")
crimefilter <- c("ASSLT-AGG-BODYFORCE", "ASSLT-AGG-GUN", "ASSLT-AGG-WEAPON", "ASSLT-OTHER",
"DRIVE-BY", "HOMICIDE-JUST-GUN", "HOMICIDE-JUST-WEAPON",
"HOMICIDE-NEG-MANS-BODYFORCE", "HOMICIDE-NEG-MANS-GUN",
"HOMICIDE-PREMEDITATED-BODYFORC", "HOMICIDE-PREMEDITATED-GUN",
"NARC-DISTRIBUTE-HALLUCINOGEN", "NARC-DRUG TRAFFIC LOITERING",
"NARC-EQUIPMENT/PARAPHENALIA", "NARC-FORGERY-PRESCRIPTION",
"NARC-FOUND-AMPHETAMINE", "NARC-FOUND-COCAINE", "NARC-FOUND-HALLUCINOGEN",
"NARC-FOUND-HEROIN", "NARC-FOUND-METH", "NARC-FOUND-OPIUM",
"NARC-FOUND-PILL/TABLET", "NARC-FOUND-SYNTHETIC", "NARC-FRAUD-PRESCRIPTION",
"NARC-MANUFACTURE-HALLUCINOGEN", "NARC-MANUFACTURE-OTHER",
"NARC-POSSESS-AMPHETAMINE", "NARC-POSSESS-BARBITUATE", "NARC-POSSESS-COCAINE",
"NARC-POSSESS-HALLUCINOGEN", "NARC-POSSESS-HEROIN", "NARC-POSSESS-METH",
"NARC-POSSESS-OPIUM", "NARC-POSSESS-PILL/TABLET", "NARC-POSSESS-PRESCRIPTION",
"NARC-POSSESS-SYNTHETIC", "NARC-SELL-AMPHETAMINE", "NARC-SELL-BARBITUATE",
"NARC-SELL-COCAINE", "NARC-SELL-HALLUCINOGEN", "NARC-SELL-HEROIN",
"NARC-SELL-METH", "NARC-SELL-OPIUM", "NARC-SELL-PILL/TABLET",
"NARC-SELL-PRESCRIPTION", "NARC-SELL-SYNTHETIC", "NARC-SMUGGLE-COCAINE",
"NARC-SMUGGLE-METH", "NARC-SMUGGLE-OTHER", "ROBBERY-RESIDENCE-GUN",
"ROBBERY-RESIDENCE-WEAPON", "ROBBERY-STREET-BODYFORCE", "ROBBERY-STREET-GUN",
"ROBBERY-STREET-WEAPON", "THREATS-KILL", "THREATS-OTHER", "THREATS-WEAPON",
"WEAPON-CONCEALED", "WEAPON-DISCHARGE", "WEAPON-POSSESSION", "WEAPON-SELLING",
"WEAPON-SURRENDER-EXCLUDING FIR", "WEAPON-UNLAWFUL USE")
crime <- filter(crime, Offense.Type %in% crimefilter)
Expand All @@ -73,7 +101,7 @@ Using the prepared data, we can look visually at the reported crime trends in th

```{r allperiods}
library(lattice)
rate0815 <- aggregate(RMS.CDW.ID ~ Date.Reported, data=crime, FUN=length)
xyplot(RMS.CDW.ID ~ Date.Reported, data=rate0815,
Expand Down
35 changes: 28 additions & 7 deletions seattle_crime_2008-2014-reported.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ <h2>Synopsis</h2>
<h2>Data Processing</h2>
<p>Crime data are available from the City of Seattle in a well organized format that is divided by police sector and crime type. This specific data set is based on initial police reports taken by officers when responding to incidents around the city. It is worth noting that this analysis is based on data collected when police are dispatched to investigate a crime report, which implies that unreported crime is not represented. However, it is assumed that any increase in unreported crime would induce a similar signal in reported crime.</p>
<p>Data are read directly from the City of Seattle site for processing:</p>
<pre class="r"><code>library(dplyr, warn.conflicts=F, quietly=T)

# get data
<pre class="r"><code>if(!file.exists(&quot;Seattle_Police_Department_Police_Report_Incident.csv&quot;) &amp;
file.exists(&quot;Seattle_Police_Department_Police_Report_Incident.zip&quot;))
{
unzip(&quot;Seattle_Police_Department_Police_Report_Incident.zip&quot;)
}
if(!file.exists(&quot;Seattle_Police_Department_Police_Report_Incident.csv&quot;))
{
download.file(&quot;https://data.seattle.gov/api/views/7ais-f98f/rows.csv?accessType=DOWNLOAD&quot;, &quot;Seattle_Police_Department_Police_Report_Incident.csv&quot;, method=&quot;internal&quot;, mode=&quot;w&quot;)
Expand All @@ -97,16 +99,35 @@ <h2>Data Processing</h2>
crime &lt;- filter(crime, District.Sector %in% c(&quot;E&quot;, &quot;C&quot;, &quot;G&quot;, &quot;R&quot;, &quot;S&quot;))</code></pre>
<p>Then we filter out all crimes that are not related to violent crimes, weapons, weapons discharge, and narcotics; marijuana related crimes are specifically excluded to avoid bias between the before and after I-502 period:</p>
<pre class="r"><code># specific crimes only
crimefilter &lt;- c(&quot;ASSLT-AGG-BODYFORCE&quot;, &quot;ASSLT-AGG-GUN&quot;, &quot;ASSLT-AGG-WEAPON&quot;, &quot;ASSLT-OTHER&quot;, &quot;DRIVE-BY&quot;, &quot;HOMICIDE-JUST-GUN&quot;, &quot;HOMICIDE-JUST-WEAPON&quot;, &quot;HOMICIDE-NEG-MANS-BODYFORCE&quot;, &quot;HOMICIDE-NEG-MANS-GUN&quot;, &quot;HOMICIDE-PREMEDITATED-BODYFORC&quot;, &quot;HOMICIDE-PREMEDITATED-GUN&quot;, &quot;NARC-DISTRIBUTE-HALLUCINOGEN&quot;, &quot;NARC-DRUG TRAFFIC LOITERING&quot;, &quot;NARC-EQUIPMENT/PARAPHENALIA&quot;, &quot;NARC-FORGERY-PRESCRIPTION&quot;, &quot;NARC-FOUND-AMPHETAMINE&quot;, &quot;NARC-FOUND-COCAINE&quot;, &quot;NARC-FOUND-HALLUCINOGEN&quot;, &quot;NARC-FOUND-HEROIN&quot;, &quot;NARC-FOUND-METH&quot;, &quot;NARC-FOUND-OPIUM&quot;, &quot;NARC-FOUND-PILL/TABLET&quot;, &quot;NARC-FOUND-SYNTHETIC&quot;, &quot;NARC-FRAUD-PRESCRIPTION&quot;, &quot;NARC-MANUFACTURE-HALLUCINOGEN&quot;, &quot;NARC-MANUFACTURE-OTHER&quot;, &quot;NARC-POSSESS-AMPHETAMINE&quot;, &quot;NARC-POSSESS-BARBITUATE&quot;, &quot;NARC-POSSESS-COCAINE&quot;, &quot;NARC-POSSESS-HALLUCINOGEN&quot;, &quot;NARC-POSSESS-HEROIN&quot;, &quot;NARC-POSSESS-METH&quot;, &quot;NARC-POSSESS-OPIUM&quot;, &quot;NARC-POSSESS-PILL/TABLET&quot;, &quot;NARC-POSSESS-PRESCRIPTION&quot;, &quot;NARC-POSSESS-SYNTHETIC&quot;, &quot;NARC-SELL-AMPHETAMINE&quot;, &quot;NARC-SELL-BARBITUATE&quot;, &quot;NARC-SELL-COCAINE&quot;, &quot;NARC-SELL-HALLUCINOGEN&quot;, &quot;NARC-SELL-HEROIN&quot;, &quot;NARC-SELL-METH&quot;, &quot;NARC-SELL-OPIUM&quot;, &quot;NARC-SELL-PILL/TABLET&quot;, &quot;NARC-SELL-PRESCRIPTION&quot;, &quot;NARC-SELL-SYNTHETIC&quot;, &quot;NARC-SMUGGLE-COCAINE&quot;, &quot;NARC-SMUGGLE-METH&quot;, &quot;NARC-SMUGGLE-OTHER&quot;, &quot;ROBBERY-RESIDENCE-GUN&quot;, &quot;ROBBERY-RESIDENCE-WEAPON&quot;, &quot;ROBBERY-STREET-BODYFORCE&quot;, &quot;ROBBERY-STREET-GUN&quot;, &quot;ROBBERY-STREET-WEAPON&quot;, &quot;THREATS-KILL&quot;, &quot;THREATS-OTHER&quot;, &quot;THREATS-WEAPON&quot;, &quot;WEAPON-CONCEALED&quot;, &quot;WEAPON-DISCHARGE&quot;, &quot;WEAPON-POSSESSION&quot;, &quot;WEAPON-SELLING&quot;, &quot;WEAPON-SURRENDER-EXCLUDING FIR&quot;, &quot;WEAPON-UNLAWFUL USE&quot;)
crimefilter &lt;- c(&quot;ASSLT-AGG-BODYFORCE&quot;, &quot;ASSLT-AGG-GUN&quot;, &quot;ASSLT-AGG-WEAPON&quot;, &quot;ASSLT-OTHER&quot;,
&quot;DRIVE-BY&quot;, &quot;HOMICIDE-JUST-GUN&quot;, &quot;HOMICIDE-JUST-WEAPON&quot;,
&quot;HOMICIDE-NEG-MANS-BODYFORCE&quot;, &quot;HOMICIDE-NEG-MANS-GUN&quot;,
&quot;HOMICIDE-PREMEDITATED-BODYFORC&quot;, &quot;HOMICIDE-PREMEDITATED-GUN&quot;,
&quot;NARC-DISTRIBUTE-HALLUCINOGEN&quot;, &quot;NARC-DRUG TRAFFIC LOITERING&quot;,
&quot;NARC-EQUIPMENT/PARAPHENALIA&quot;, &quot;NARC-FORGERY-PRESCRIPTION&quot;,
&quot;NARC-FOUND-AMPHETAMINE&quot;, &quot;NARC-FOUND-COCAINE&quot;, &quot;NARC-FOUND-HALLUCINOGEN&quot;,
&quot;NARC-FOUND-HEROIN&quot;, &quot;NARC-FOUND-METH&quot;, &quot;NARC-FOUND-OPIUM&quot;,
&quot;NARC-FOUND-PILL/TABLET&quot;, &quot;NARC-FOUND-SYNTHETIC&quot;, &quot;NARC-FRAUD-PRESCRIPTION&quot;,
&quot;NARC-MANUFACTURE-HALLUCINOGEN&quot;, &quot;NARC-MANUFACTURE-OTHER&quot;,
&quot;NARC-POSSESS-AMPHETAMINE&quot;, &quot;NARC-POSSESS-BARBITUATE&quot;, &quot;NARC-POSSESS-COCAINE&quot;,
&quot;NARC-POSSESS-HALLUCINOGEN&quot;, &quot;NARC-POSSESS-HEROIN&quot;, &quot;NARC-POSSESS-METH&quot;,
&quot;NARC-POSSESS-OPIUM&quot;, &quot;NARC-POSSESS-PILL/TABLET&quot;, &quot;NARC-POSSESS-PRESCRIPTION&quot;,
&quot;NARC-POSSESS-SYNTHETIC&quot;, &quot;NARC-SELL-AMPHETAMINE&quot;, &quot;NARC-SELL-BARBITUATE&quot;,
&quot;NARC-SELL-COCAINE&quot;, &quot;NARC-SELL-HALLUCINOGEN&quot;, &quot;NARC-SELL-HEROIN&quot;,
&quot;NARC-SELL-METH&quot;, &quot;NARC-SELL-OPIUM&quot;, &quot;NARC-SELL-PILL/TABLET&quot;,
&quot;NARC-SELL-PRESCRIPTION&quot;, &quot;NARC-SELL-SYNTHETIC&quot;, &quot;NARC-SMUGGLE-COCAINE&quot;,
&quot;NARC-SMUGGLE-METH&quot;, &quot;NARC-SMUGGLE-OTHER&quot;, &quot;ROBBERY-RESIDENCE-GUN&quot;,
&quot;ROBBERY-RESIDENCE-WEAPON&quot;, &quot;ROBBERY-STREET-BODYFORCE&quot;, &quot;ROBBERY-STREET-GUN&quot;,
&quot;ROBBERY-STREET-WEAPON&quot;, &quot;THREATS-KILL&quot;, &quot;THREATS-OTHER&quot;, &quot;THREATS-WEAPON&quot;,
&quot;WEAPON-CONCEALED&quot;, &quot;WEAPON-DISCHARGE&quot;, &quot;WEAPON-POSSESSION&quot;, &quot;WEAPON-SELLING&quot;,
&quot;WEAPON-SURRENDER-EXCLUDING FIR&quot;, &quot;WEAPON-UNLAWFUL USE&quot;)

crime &lt;- filter(crime, Offense.Type %in% crimefilter)</code></pre>
</div>
<div id="results" class="section level2">
<h2>Results</h2>
<p>Using the prepared data, we can look visually at the reported crime trends in the East and South precincts from 2008-2014. A linear trend line is shown in red and the date of the first I-502 shop opening in Seattle (July 8, 2014) is indicated by the vertical black line.</p>
<pre class="r"><code>library(lattice)

rate0815 &lt;- aggregate(RMS.CDW.ID ~ Date.Reported, data=crime, FUN=length)
<pre class="r"><code>rate0815 &lt;- aggregate(RMS.CDW.ID ~ Date.Reported, data=crime, FUN=length)
xyplot(RMS.CDW.ID ~ Date.Reported, data=rate0815,
panel=function(x, y, col, ...) {
panel.xyplot(x, y, col=&quot;blue&quot;, ...)
Expand Down
33 changes: 27 additions & 6 deletions seattle_crime_2008-2014-reported.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ Data are read directly from the City of Seattle site for processing:


```r
library(dplyr, warn.conflicts=F, quietly=T)

# get data
if(!file.exists("Seattle_Police_Department_Police_Report_Incident.csv") &
file.exists("Seattle_Police_Department_Police_Report_Incident.zip"))
{
unzip("Seattle_Police_Department_Police_Report_Incident.zip")
}
if(!file.exists("Seattle_Police_Department_Police_Report_Incident.csv"))
{
download.file("https://data.seattle.gov/api/views/7ais-f98f/rows.csv?accessType=DOWNLOAD", "Seattle_Police_Department_Police_Report_Incident.csv", method="internal", mode="w")
Expand Down Expand Up @@ -49,7 +51,28 @@ Then we filter out all crimes that are not related to violent crimes, weapons, w

```r
# specific crimes only
crimefilter <- c("ASSLT-AGG-BODYFORCE", "ASSLT-AGG-GUN", "ASSLT-AGG-WEAPON", "ASSLT-OTHER", "DRIVE-BY", "HOMICIDE-JUST-GUN", "HOMICIDE-JUST-WEAPON", "HOMICIDE-NEG-MANS-BODYFORCE", "HOMICIDE-NEG-MANS-GUN", "HOMICIDE-PREMEDITATED-BODYFORC", "HOMICIDE-PREMEDITATED-GUN", "NARC-DISTRIBUTE-HALLUCINOGEN", "NARC-DRUG TRAFFIC LOITERING", "NARC-EQUIPMENT/PARAPHENALIA", "NARC-FORGERY-PRESCRIPTION", "NARC-FOUND-AMPHETAMINE", "NARC-FOUND-COCAINE", "NARC-FOUND-HALLUCINOGEN", "NARC-FOUND-HEROIN", "NARC-FOUND-METH", "NARC-FOUND-OPIUM", "NARC-FOUND-PILL/TABLET", "NARC-FOUND-SYNTHETIC", "NARC-FRAUD-PRESCRIPTION", "NARC-MANUFACTURE-HALLUCINOGEN", "NARC-MANUFACTURE-OTHER", "NARC-POSSESS-AMPHETAMINE", "NARC-POSSESS-BARBITUATE", "NARC-POSSESS-COCAINE", "NARC-POSSESS-HALLUCINOGEN", "NARC-POSSESS-HEROIN", "NARC-POSSESS-METH", "NARC-POSSESS-OPIUM", "NARC-POSSESS-PILL/TABLET", "NARC-POSSESS-PRESCRIPTION", "NARC-POSSESS-SYNTHETIC", "NARC-SELL-AMPHETAMINE", "NARC-SELL-BARBITUATE", "NARC-SELL-COCAINE", "NARC-SELL-HALLUCINOGEN", "NARC-SELL-HEROIN", "NARC-SELL-METH", "NARC-SELL-OPIUM", "NARC-SELL-PILL/TABLET", "NARC-SELL-PRESCRIPTION", "NARC-SELL-SYNTHETIC", "NARC-SMUGGLE-COCAINE", "NARC-SMUGGLE-METH", "NARC-SMUGGLE-OTHER", "ROBBERY-RESIDENCE-GUN", "ROBBERY-RESIDENCE-WEAPON", "ROBBERY-STREET-BODYFORCE", "ROBBERY-STREET-GUN", "ROBBERY-STREET-WEAPON", "THREATS-KILL", "THREATS-OTHER", "THREATS-WEAPON", "WEAPON-CONCEALED", "WEAPON-DISCHARGE", "WEAPON-POSSESSION", "WEAPON-SELLING", "WEAPON-SURRENDER-EXCLUDING FIR", "WEAPON-UNLAWFUL USE")
crimefilter <- c("ASSLT-AGG-BODYFORCE", "ASSLT-AGG-GUN", "ASSLT-AGG-WEAPON", "ASSLT-OTHER",
"DRIVE-BY", "HOMICIDE-JUST-GUN", "HOMICIDE-JUST-WEAPON",
"HOMICIDE-NEG-MANS-BODYFORCE", "HOMICIDE-NEG-MANS-GUN",
"HOMICIDE-PREMEDITATED-BODYFORC", "HOMICIDE-PREMEDITATED-GUN",
"NARC-DISTRIBUTE-HALLUCINOGEN", "NARC-DRUG TRAFFIC LOITERING",
"NARC-EQUIPMENT/PARAPHENALIA", "NARC-FORGERY-PRESCRIPTION",
"NARC-FOUND-AMPHETAMINE", "NARC-FOUND-COCAINE", "NARC-FOUND-HALLUCINOGEN",
"NARC-FOUND-HEROIN", "NARC-FOUND-METH", "NARC-FOUND-OPIUM",
"NARC-FOUND-PILL/TABLET", "NARC-FOUND-SYNTHETIC", "NARC-FRAUD-PRESCRIPTION",
"NARC-MANUFACTURE-HALLUCINOGEN", "NARC-MANUFACTURE-OTHER",
"NARC-POSSESS-AMPHETAMINE", "NARC-POSSESS-BARBITUATE", "NARC-POSSESS-COCAINE",
"NARC-POSSESS-HALLUCINOGEN", "NARC-POSSESS-HEROIN", "NARC-POSSESS-METH",
"NARC-POSSESS-OPIUM", "NARC-POSSESS-PILL/TABLET", "NARC-POSSESS-PRESCRIPTION",
"NARC-POSSESS-SYNTHETIC", "NARC-SELL-AMPHETAMINE", "NARC-SELL-BARBITUATE",
"NARC-SELL-COCAINE", "NARC-SELL-HALLUCINOGEN", "NARC-SELL-HEROIN",
"NARC-SELL-METH", "NARC-SELL-OPIUM", "NARC-SELL-PILL/TABLET",
"NARC-SELL-PRESCRIPTION", "NARC-SELL-SYNTHETIC", "NARC-SMUGGLE-COCAINE",
"NARC-SMUGGLE-METH", "NARC-SMUGGLE-OTHER", "ROBBERY-RESIDENCE-GUN",
"ROBBERY-RESIDENCE-WEAPON", "ROBBERY-STREET-BODYFORCE", "ROBBERY-STREET-GUN",
"ROBBERY-STREET-WEAPON", "THREATS-KILL", "THREATS-OTHER", "THREATS-WEAPON",
"WEAPON-CONCEALED", "WEAPON-DISCHARGE", "WEAPON-POSSESSION", "WEAPON-SELLING",
"WEAPON-SURRENDER-EXCLUDING FIR", "WEAPON-UNLAWFUL USE")

crime <- filter(crime, Offense.Type %in% crimefilter)
```
Expand All @@ -62,8 +85,6 @@ Using the prepared data, we can look visually at the reported crime trends in th


```r
library(lattice)

rate0815 <- aggregate(RMS.CDW.ID ~ Date.Reported, data=crime, FUN=length)
xyplot(RMS.CDW.ID ~ Date.Reported, data=rate0815,
panel=function(x, y, col, ...) {
Expand Down

0 comments on commit 6254ff0

Please sign in to comment.