summaryrefslogtreecommitdiffstats
path: root/R Scripts/arrest-vs-infection-times.R
diff options
context:
space:
mode:
Diffstat (limited to 'R Scripts/arrest-vs-infection-times.R')
-rw-r--r--R Scripts/arrest-vs-infection-times.R35
1 files changed, 34 insertions, 1 deletions
diff --git a/R Scripts/arrest-vs-infection-times.R b/R Scripts/arrest-vs-infection-times.R
index 222be3e..7c0bfcf 100644
--- a/R Scripts/arrest-vs-infection-times.R
+++ b/R Scripts/arrest-vs-infection-times.R
@@ -1,6 +1,38 @@
library(igraph)
-setwd('~/Documents/Cascade Project/Raw Data/')
+setwd('~/Documents/Violence Cascades/Raw Data/')
+
+person_verts = get.data.frame(person,'vertices')
+vics = person_verts$vic
+vic_verts = person_verts[vics,14:19]
+first_vics = apply(vic_verts,1,min,na.rm=T)
+
+
+load('arrests.RData')
+arr = arrests[order(arrests$date2),]
+arr = arr[match(unique(arr$ir2),arr$ir2),]
+arr = arr[match(rownames(person_verts),arr$ir2),]
+arr = arr[vics,]
+offset = 16802
+first_arrests = as.numeric(arr$date2) - offset
+
+lag = first_vics - first_arrests
+hist(lag,100,col='')
+h = hist(lag,150,col='#1f78b4',border=NA,axes=T,
+ xlab='',ylab='Frequency',main=NULL)
+box(lwd=1.1)
+
+
+
+
+
+
+
+
+
+
+
+#### OLD VERSION
##### Load arrest data
arrests <- read.csv("2006to2014arrests2.csv", header=T, colClass=c("character"))
arrests$ir2 <- paste("ir", arrests$ir_no)
@@ -41,3 +73,4 @@ murders = murders[murders$ir2 %in% arrests$ir2,]
mur_dates = murders$INJURY_DATE
arrest_dates = sub.arrests$dates[match(murders$ir2, sub.arrests$individuals)]
sum(mur_dates==arrest_dates)
+