Quantifying the causal relationship between extreme climate and human conflict.
population<-read.csv("https://raw.githubusercontent.com/RobertSellers/crime_and_weather_study/master/data/Export/crimeANDweather_v1.csv", sep=",",na.strings = "NA",header = TRUE,stringsAsFactors = FALSE)
population$meanMaxF<-round(population$meanMaxF,0)
head(population,3)
## X city state year lat long airportID meanMaxF crimeRate
## 1 1 Abilene TX 1985 32.44874 -99.73314 ABI 42 355
## 2 2 Abilene TX 1986 32.44874 -99.73314 ABI 45 859
## 3 3 Abilene TX 1987 32.44874 -99.73314 ABI 45 890
population1<- subset(population,population$city=='Akron City' & population$year >2005)
plot_ly(population1, x = year, y = crimeRate, size = crimeRate,color = meanMaxF,opacity = meanMaxF, mode = "markers",colors ="Reds") %>% layout(title = "Temperature V/S Crime rate in Akron City",xaxis=list(title = "Year"),yaxis=list(title = "Crime Rate"))
population2<- subset(population,population$city=='Ann Arbor' & population$year >2005)
plot_ly(population2, x = year, y = crimeRate, size = crimeRate,color = meanMaxF,opacity = meanMaxF, mode = "markers",colors ="Reds",text = paste("Total Crime: ", crimeRate,"Temperature:",meanMaxF)) %>% layout(title = "Temperature V/S Crime rate in Ann Arbor",yaxis=list(title = "Crime Rate"))