Chapter 3 Read the Data
Read the CrimeData using the function read_csv.
library(tidyverse)
library(leaflet)
library(stringr)
library(rgdal)
library(lubridate)
library(forecast)
library(knitr)
library(kableExtra)
library(prophet)
library(webshot)
library(xgboost)
library(caret)
rm(list=ls())
fillColor = "#FFA07A"
fillColor2 = "#F1C40F"
LACrime = read_csv("input/Crime_Data_2010_2017.csv")
3.1 Peek into the data
kable(head(LACrime),"html") %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive")) %>%
scroll_box(width = "800px")
DR Number | Date Reported | Date Occurred | Time Occurred | Area ID | Area Name | Reporting District | Crime Code | Crime Code Description | MO Codes | Victim Age | Victim Sex | Victim Descent | Premise Code | Premise Description | Weapon Used Code | Weapon Description | Status Code | Status Description | Crime Code 1 | Crime Code 2 | Crime Code 3 | Crime Code 4 | Address | Cross Street | Location |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1208575 | 03/14/2013 | 03/11/2013 | 1800 | 12 | 77th Street | 1241 | 626 | INTIMATE PARTNER - SIMPLE ASSAULT | 0416 0446 1243 2000 | 30 | F | W | 502 | MULTI-UNIT DWELLING (APARTMENT, DUPLEX, ETC) | 400 | STRONG-ARM (HANDS, FIST, FEET OR BODILY FORCE) | AO | Adult Other | 626 | NA | NA | NA | 6300 BRYNHURST AV | NA | (33.9829, -118.3338) |
102005556 | 01/25/2010 | 01/22/2010 | 2300 | 20 | Olympic | 2071 | 510 | VEHICLE - STOLEN | NA | NA | NA | NA | 101 | STREET | NA | NA | IC | Invest Cont | 510 | NA | NA | NA | VAN NESS | 15TH | (34.0454, -118.3157) |
418 | 03/19/2013 | 03/18/2013 | 2030 | 18 | Southeast | 1823 | 510 | VEHICLE - STOLEN | NA | 12 | NA | NA | 101 | STREET | NA | NA | IC | Invest Cont | 510 | NA | NA | NA | 200 E 104TH ST | NA | (33.942, -118.2717) |
101822289 | 11/11/2010 | 11/10/2010 | 1800 | 18 | Southeast | 1803 | 510 | VEHICLE - STOLEN | NA | NA | NA | NA | 101 | STREET | NA | NA | IC | Invest Cont | 510 | NA | NA | NA | 88TH | WALL | (33.9572, -118.2717) |
42104479 | 01/11/2014 | 01/04/2014 | 2300 | 21 | Topanga | 2133 | 745 | VANDALISM - MISDEAMEANOR ($399 OR UNDER) | 0329 | 84 | M | W | 501 | SINGLE FAMILY DWELLING | NA | NA | IC | Invest Cont | 745 | NA | NA | NA | 7200 CIRRUS WY | NA | (34.2009, -118.6369) |
120125367 | 01/08/2013 | 01/08/2013 | 1400 | 1 | Central | 111 | 110 | CRIMINAL HOMICIDE | 1243 2000 1813 1814 2002 0416 0400 | 49 | F | W | 501 | SINGLE FAMILY DWELLING | 400 | STRONG-ARM (HANDS, FIST, FEET OR BODILY FORCE) | AA | Adult Arrest | 110 | NA | NA | NA | 600 N HILL ST | NA | (34.0591, -118.2412) |