#Project one: MARYLAND CRIME STATS FROM 1975-2016 ##by Kevin Tukei ##June 18, 2019

#Summary/Background ###The following dataset contains Maryland crime data by county from 1975-2016. ###Install dplyr

library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(tidyverse)
## Registered S3 methods overwritten by 'ggplot2':
##   method         from 
##   [.quosures     rlang
##   c.quosures     rlang
##   print.quosures rlang
## -- Attaching packages ------------------------------------------------------------- tidyverse 1.2.1 --
## v ggplot2 3.1.1     v readr   1.3.1
## v tibble  2.1.3     v purrr   0.3.2
## v tidyr   0.8.3     v stringr 1.4.0
## v ggplot2 3.1.1     v forcats 0.4.0
## -- Conflicts ---------------------------------------------------------------- tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()

###Pull the Data from CSV

MDcrime<-read.csv(file = "MDcrime.csv")

##Dimensions and Structure of the dataframe

dim(MDcrime)
## [1] 1008   38
str(MDcrime)
## 'data.frame':    1008 obs. of  38 variables:
##  $ JURISDICTION                                         : Factor w/ 26 levels "Allegany County",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ YEAR                                                 : Factor w/ 42 levels "1/1/1975","1/1/1976",..: 1 2 3 4 5 6 7 8 9 10 ...
##  $ POPULATION                                           : int  79655 83923 82102 79966 79721 80461 81781 81858 82605 80835 ...
##  $ MURDER                                               : int  3 2 3 1 1 2 11 1 5 2 ...
##  $ RAPE                                                 : int  5 2 7 2 7 12 13 18 9 15 ...
##  $ ROBBERY                                              : int  20 24 32 18 18 26 24 18 19 6 ...
##  $ AGGASSAULT                                           : int  114 59 85 81 84 79 101 80 89 67 ...
##  $ BE                                                   : int  669 581 592 539 502 541 539 447 347 361 ...
##  $ LARCENY.THEFT                                        : int  1425 1384 1390 1390 1611 1706 1697 1570 1412 1338 ...
##  $ MotorvehicleTHEFT                                    : int  93 73 102 100 99 108 88 55 67 68 ...
##  $ GRAND.TOTAL                                          : int  2329 2125 2211 2131 2322 2474 2473 2189 1948 1857 ...
##  $ PERCENT.CHANGE                                       : num  NA -8.8 4 -3.6 9 6.5 0 -11.5 -11 -4.7 ...
##  $ violentcrimetotal                                    : int  142 87 127 102 110 119 149 117 122 90 ...
##  $ VIOLENT.CRIME.PERCENT                                : num  6.1 4.1 5.7 4.8 4.7 4.8 6 5.3 6.3 4.8 ...
##  $ VIOLENT.CRIME.PERCENT.CHANGE                         : num  NA -38.7 46 -19.7 7.8 8.2 25.2 -21.5 4.3 -26.2 ...
##  $ PROPERTY.CRIME.TOTALS                                : int  2187 2038 2084 2029 2212 2355 2324 2072 1826 1767 ...
##  $ PROPERTY.CRIME.PERCENT                               : num  93.9 95.9 94.3 95.2 95.3 95.2 94 94.7 93.7 95.2 ...
##  $ PROPERTY.CRIME.PERCENT.CHANGE                        : num  NA -6.8 2.3 -2.6 9 6.5 -1.3 -10.8 -11.9 -3.2 ...
##  $ OVERALL.CRIME.RATE.PER.100.000.PEOPLE                : num  2924 2532 2693 2665 2913 ...
##  $ OVERALL.PERCENT.CHANGE.PER.100.000.PEOPLE            : num  NA -13.4 6.4 -1 9.3 5.6 -1.7 -11.6 -11.8 -2.6 ...
##  $ violentcrimerateper_100000                           : num  178 104 155 128 138 ...
##  $ VIOLENT.CRIME.RATE.PERCENT.CHANGE.PER.100.000.PEOPLE : num  NA -41.8 49.2 -17.5 8.2 7.2 23.2 -21.6 3.3 -24.6 ...
##  $ PROPERTY.CRIME.RATE.PER.100.000.PEOPLE               : num  2746 2428 2538 2537 2775 ...
##  $ PROPERTY.CRIME.RATE.PERCENT.CHANGE.PER.100.000.PEOPLE: num  NA -11.6 4.5 0 9.4 5.5 -2.9 -10.9 -12.7 -1.1 ...
##  $ murderper100000                                      : num  3.8 2.4 3.7 1.3 1.3 2.5 13.5 1.2 6.1 2.5 ...
##  $ RAPE.PER.100.000.PEOPLE                              : num  6.3 2.4 8.5 2.5 8.8 14.9 15.9 22 10.9 18.6 ...
##  $ robberyper100000                                     : num  25.1 28.6 39 22.5 22.6 32.3 29.3 22 23 7.4 ...
##  $ AGG..ASSAULT.PER.100.000.PEOPLE                      : num  143.1 70.3 103.5 101.3 105.4 ...
##  $ B...E.PER.100.000.PEOPLE                             : num  840 692 721 674 630 ...
##  $ LARCENY.THEFT.PER.100.000.PEOPLE                     : num  1789 1649 1693 1738 2021 ...
##  $ M.V.THEFT.PER.100.000.PEOPLE                         : num  117 87 124 125 124 ...
##  $ MURDER..RATE.PERCENT.CHANGE.PER.100.000.PEOPLE       : num  NA -36.7 53.3 -65.8 0.3 ...
##  $ RAPE.RATE.PERCENT.CHANGE.PER.100.000.PEOPLE          : num  NA -62 257.8 -70.7 251.1 ...
##  $ ROBBERY.RATE.PERCENT.CHANGE.PER.100.000.PEOPLE       : num  NA 13.9 36.3 -42.2 0.3 43.1 -9.2 -25.1 4.6 -67.7 ...
##  $ AGG..ASSAULT..RATE.PERCENT.CHANGE.PER.100.000.PEOPLE : num  NA -50.9 47.3 -2.2 4 -6.8 25.8 -20.9 10.2 -23.1 ...
##  $ B...E.RATE.PERCENT.CHANGE.PER.100.000.PEOPLE         : num  NA -17.6 4.2 -6.5 -6.6 6.8 -2 -17.1 -23.1 6.3 ...
##  $ LARCENY.THEFT..RATE.PERCENT.CHANGE.PER.100.000.PEOPLE: num  NA -7.8 2.7 2.7 16.3 4.9 -2.1 -7.6 -10.9 -3.2 ...
##  $ M.V.THEFT..RATE.PERCENT.CHANGE.PER.100.000.PEOPLE    : num  NA -25.5 42.8 0.7 -0.7 8.1 -19.8 -37.6 20.7 3.7 ...

###The dataframe consists of 1008 observations and 38 variables ##Head and Tail of the dataframe

head(MDcrime)
##      JURISDICTION     YEAR POPULATION MURDER RAPE ROBBERY AGGASSAULT  BE
## 1 Allegany County 1/1/1975      79655      3    5      20        114 669
## 2 Allegany County 1/1/1976      83923      2    2      24         59 581
## 3 Allegany County 1/1/1977      82102      3    7      32         85 592
## 4 Allegany County 1/1/1978      79966      1    2      18         81 539
## 5 Allegany County 1/1/1979      79721      1    7      18         84 502
## 6 Allegany County 1/1/1980      80461      2   12      26         79 541
##   LARCENY.THEFT MotorvehicleTHEFT GRAND.TOTAL PERCENT.CHANGE
## 1          1425                93        2329             NA
## 2          1384                73        2125           -8.8
## 3          1390               102        2211            4.0
## 4          1390               100        2131           -3.6
## 5          1611                99        2322            9.0
## 6          1706               108        2474            6.5
##   violentcrimetotal VIOLENT.CRIME.PERCENT VIOLENT.CRIME.PERCENT.CHANGE
## 1               142                   6.1                           NA
## 2                87                   4.1                        -38.7
## 3               127                   5.7                         46.0
## 4               102                   4.8                        -19.7
## 5               110                   4.7                          7.8
## 6               119                   4.8                          8.2
##   PROPERTY.CRIME.TOTALS PROPERTY.CRIME.PERCENT
## 1                  2187                   93.9
## 2                  2038                   95.9
## 3                  2084                   94.3
## 4                  2029                   95.2
## 5                  2212                   95.3
## 6                  2355                   95.2
##   PROPERTY.CRIME.PERCENT.CHANGE OVERALL.CRIME.RATE.PER.100.000.PEOPLE
## 1                            NA                                2923.9
## 2                          -6.8                                2532.1
## 3                           2.3                                2693.0
## 4                          -2.6                                2664.9
## 5                           9.0                                2912.7
## 6                           6.5                                3074.8
##   OVERALL.PERCENT.CHANGE.PER.100.000.PEOPLE violentcrimerateper_100000
## 1                                        NA                      178.3
## 2                                     -13.4                      103.7
## 3                                       6.4                      154.7
## 4                                      -1.0                      127.6
## 5                                       9.3                      138.0
## 6                                       5.6                      147.9
##   VIOLENT.CRIME.RATE.PERCENT.CHANGE.PER.100.000.PEOPLE
## 1                                                   NA
## 2                                                -41.8
## 3                                                 49.2
## 4                                                -17.5
## 5                                                  8.2
## 6                                                  7.2
##   PROPERTY.CRIME.RATE.PER.100.000.PEOPLE
## 1                                 2745.6
## 2                                 2428.4
## 3                                 2538.3
## 4                                 2537.3
## 5                                 2774.7
## 6                                 2926.9
##   PROPERTY.CRIME.RATE.PERCENT.CHANGE.PER.100.000.PEOPLE murderper100000
## 1                                                    NA             3.8
## 2                                                 -11.6             2.4
## 3                                                   4.5             3.7
## 4                                                   0.0             1.3
## 5                                                   9.4             1.3
## 6                                                   5.5             2.5
##   RAPE.PER.100.000.PEOPLE robberyper100000 AGG..ASSAULT.PER.100.000.PEOPLE
## 1                     6.3             25.1                           143.1
## 2                     2.4             28.6                            70.3
## 3                     8.5             39.0                           103.5
## 4                     2.5             22.5                           101.3
## 5                     8.8             22.6                           105.4
## 6                    14.9             32.3                            98.2
##   B...E.PER.100.000.PEOPLE LARCENY.THEFT.PER.100.000.PEOPLE
## 1                    839.9                           1789.0
## 2                    692.3                           1649.1
## 3                    721.1                           1693.0
## 4                    674.0                           1738.2
## 5                    629.7                           2020.8
## 6                    672.4                           2120.3
##   M.V.THEFT.PER.100.000.PEOPLE
## 1                        116.8
## 2                         87.0
## 3                        124.2
## 4                        125.1
## 5                        124.2
## 6                        134.2
##   MURDER..RATE.PERCENT.CHANGE.PER.100.000.PEOPLE
## 1                                             NA
## 2                                          -36.7
## 3                                           53.3
## 4                                          -65.8
## 5                                            0.3
## 6                                           98.2
##   RAPE.RATE.PERCENT.CHANGE.PER.100.000.PEOPLE
## 1                                          NA
## 2                                       -62.0
## 3                                       257.8
## 4                                       -70.7
## 5                                       251.1
## 6                                        69.9
##   ROBBERY.RATE.PERCENT.CHANGE.PER.100.000.PEOPLE
## 1                                             NA
## 2                                           13.9
## 3                                           36.3
## 4                                          -42.2
## 5                                            0.3
## 6                                           43.1
##   AGG..ASSAULT..RATE.PERCENT.CHANGE.PER.100.000.PEOPLE
## 1                                                   NA
## 2                                                -50.9
## 3                                                 47.3
## 4                                                 -2.2
## 5                                                  4.0
## 6                                                 -6.8
##   B...E.RATE.PERCENT.CHANGE.PER.100.000.PEOPLE
## 1                                           NA
## 2                                        -17.6
## 3                                          4.2
## 4                                         -6.5
## 5                                         -6.6
## 6                                          6.8
##   LARCENY.THEFT..RATE.PERCENT.CHANGE.PER.100.000.PEOPLE
## 1                                                    NA
## 2                                                  -7.8
## 3                                                   2.7
## 4                                                   2.7
## 5                                                  16.3
## 6                                                   4.9
##   M.V.THEFT..RATE.PERCENT.CHANGE.PER.100.000.PEOPLE
## 1                                                NA
## 2                                             -25.5
## 3                                              42.8
## 4                                               0.7
## 5                                              -0.7
## 6                                               8.1
tail(MDcrime)
##          JURISDICTION     YEAR POPULATION MURDER RAPE ROBBERY AGGASSAULT
## 1003 Worcester County 1/1/2011      51942      1    7      28        212
## 1004 Worcester County 1/1/2012      52011      1   16      31        138
## 1005 Worcester County 1/1/2013      51718      2   14      28        173
## 1006 Worcester County 1/1/2014      51756      1   14      35        140
## 1007 Worcester County 1/1/2015      51566      1   15      27        102
## 1008 Worcester County 1/1/2016      51255      3   17      39         93
##       BE LARCENY.THEFT MotorvehicleTHEFT GRAND.TOTAL PERCENT.CHANGE
## 1003 423          1852                41        2564           -2.0
## 1004 432          1751                33        2402           -6.3
## 1005 356          1705                55        2333           -2.9
## 1006 445          1754                38        2427            4.0
## 1007 273          1562                28        2008          -17.3
## 1008 289          1514                32        1987           -1.0
##      violentcrimetotal VIOLENT.CRIME.PERCENT VIOLENT.CRIME.PERCENT.CHANGE
## 1003               248                   9.7                         -5.0
## 1004               186                   7.7                        -25.0
## 1005               217                   9.3                         16.7
## 1006               190                   7.8                        -12.4
## 1007               145                   7.2                        -23.7
## 1008               152                   7.6                          4.8
##      PROPERTY.CRIME.TOTALS PROPERTY.CRIME.PERCENT
## 1003                  2316                   90.3
## 1004                  2216                   92.3
## 1005                  2116                   90.7
## 1006                  2237                   92.2
## 1007                  1863                   92.8
## 1008                  1835                   92.4
##      PROPERTY.CRIME.PERCENT.CHANGE OVERALL.CRIME.RATE.PER.100.000.PEOPLE
## 1003                          -1.7                                4936.3
## 1004                          -4.3                                4618.3
## 1005                          -4.5                                4511.0
## 1006                           5.7                                4689.3
## 1007                         -16.7                                3894.0
## 1008                          -1.5                                3876.7
##      OVERALL.PERCENT.CHANGE.PER.100.000.PEOPLE violentcrimerateper_100000
## 1003                                      -6.4                      477.5
## 1004                                      -6.4                      357.6
## 1005                                      -2.3                      419.6
## 1006                                       4.0                      367.1
## 1007                                     -17.0                      281.2
## 1008                                      -0.4                      296.6
##      VIOLENT.CRIME.RATE.PERCENT.CHANGE.PER.100.000.PEOPLE
## 1003                                                 -9.2
## 1004                                                -25.1
## 1005                                                 17.3
## 1006                                                -12.5
## 1007                                                -23.4
## 1008                                                  5.5
##      PROPERTY.CRIME.RATE.PER.100.000.PEOPLE
## 1003                                 4458.8
## 1004                                 4260.6
## 1005                                 4091.4
## 1006                                 4322.2
## 1007                                 3612.8
## 1008                                 3580.1
##      PROPERTY.CRIME.RATE.PERCENT.CHANGE.PER.100.000.PEOPLE murderper100000
## 1003                                                  -6.0             1.9
## 1004                                                  -4.4             1.9
## 1005                                                  -4.0             3.9
## 1006                                                   5.6             1.9
## 1007                                                 -16.4             1.9
## 1008                                                 -16.4             5.9
##      RAPE.PER.100.000.PEOPLE robberyper100000
## 1003                    13.5             53.9
## 1004                    30.8             59.6
## 1005                    27.1             54.1
## 1006                    27.1             67.6
## 1007                    29.1             52.4
## 1008                    33.2             76.1
##      AGG..ASSAULT.PER.100.000.PEOPLE B...E.PER.100.000.PEOPLE
## 1003                           408.1                    814.4
## 1004                           265.3                    830.6
## 1005                           334.5                    688.3
## 1006                           270.5                    859.8
## 1007                           197.8                    529.4
## 1008                           181.4                    563.8
##      LARCENY.THEFT.PER.100.000.PEOPLE M.V.THEFT.PER.100.000.PEOPLE
## 1003                           3565.5                         78.9
## 1004                           3366.6                         63.4
## 1005                           3296.7                        106.3
## 1006                           3389.0                         73.4
## 1007                           3029.1                         54.3
## 1008                           2953.9                         62.4
##      MURDER..RATE.PERCENT.CHANGE.PER.100.000.PEOPLE
## 1003                                          -76.1
## 1004                                           -0.1
## 1005                                          101.1
## 1006                                          -50.0
## 1007                                            0.4
## 1008                                          201.8
##      RAPE.RATE.PERCENT.CHANGE.PER.100.000.PEOPLE
## 1003                                       -48.5
## 1004                                       128.3
## 1005                                       -12.0
## 1006                                        -0.1
## 1007                                         7.5
## 1008                                        14.0
##      ROBBERY.RATE.PERCENT.CHANGE.PER.100.000.PEOPLE
## 1003                                          -40.5
## 1004                                           10.6
## 1005                                           -9.2
## 1006                                           24.9
## 1007                                          -22.6
## 1008                                           45.3
##      AGG..ASSAULT..RATE.PERCENT.CHANGE.PER.100.000.PEOPLE
## 1003                                                  1.8
## 1004                                                -35.0
## 1005                                                 26.1
## 1006                                                -19.1
## 1007                                                -26.9
## 1008                                                 -8.3
##      B...E.RATE.PERCENT.CHANGE.PER.100.000.PEOPLE
## 1003                                        -17.7
## 1004                                          2.0
## 1005                                        -17.1
## 1006                                         24.9
## 1007                                        -38.4
## 1008                                          6.5
##      LARCENY.THEFT..RATE.PERCENT.CHANGE.PER.100.000.PEOPLE
## 1003                                                  -2.6
## 1004                                                  -5.6
## 1005                                                  -2.1
## 1006                                                   2.8
## 1007                                                 -10.6
## 1008                                                  -2.5
##      M.V.THEFT..RATE.PERCENT.CHANGE.PER.100.000.PEOPLE
## 1003                                             -18.4
## 1004                                             -19.6
## 1005                                              67.6
## 1006                                             -31.0
## 1007                                             -26.0
## 1008                                              15.0

##Now Lets look at the variable names

names(MDcrime)
##  [1] "JURISDICTION"                                         
##  [2] "YEAR"                                                 
##  [3] "POPULATION"                                           
##  [4] "MURDER"                                               
##  [5] "RAPE"                                                 
##  [6] "ROBBERY"                                              
##  [7] "AGGASSAULT"                                           
##  [8] "BE"                                                   
##  [9] "LARCENY.THEFT"                                        
## [10] "MotorvehicleTHEFT"                                    
## [11] "GRAND.TOTAL"                                          
## [12] "PERCENT.CHANGE"                                       
## [13] "violentcrimetotal"                                    
## [14] "VIOLENT.CRIME.PERCENT"                                
## [15] "VIOLENT.CRIME.PERCENT.CHANGE"                         
## [16] "PROPERTY.CRIME.TOTALS"                                
## [17] "PROPERTY.CRIME.PERCENT"                               
## [18] "PROPERTY.CRIME.PERCENT.CHANGE"                        
## [19] "OVERALL.CRIME.RATE.PER.100.000.PEOPLE"                
## [20] "OVERALL.PERCENT.CHANGE.PER.100.000.PEOPLE"            
## [21] "violentcrimerateper_100000"                           
## [22] "VIOLENT.CRIME.RATE.PERCENT.CHANGE.PER.100.000.PEOPLE" 
## [23] "PROPERTY.CRIME.RATE.PER.100.000.PEOPLE"               
## [24] "PROPERTY.CRIME.RATE.PERCENT.CHANGE.PER.100.000.PEOPLE"
## [25] "murderper100000"                                      
## [26] "RAPE.PER.100.000.PEOPLE"                              
## [27] "robberyper100000"                                     
## [28] "AGG..ASSAULT.PER.100.000.PEOPLE"                      
## [29] "B...E.PER.100.000.PEOPLE"                             
## [30] "LARCENY.THEFT.PER.100.000.PEOPLE"                     
## [31] "M.V.THEFT.PER.100.000.PEOPLE"                         
## [32] "MURDER..RATE.PERCENT.CHANGE.PER.100.000.PEOPLE"       
## [33] "RAPE.RATE.PERCENT.CHANGE.PER.100.000.PEOPLE"          
## [34] "ROBBERY.RATE.PERCENT.CHANGE.PER.100.000.PEOPLE"       
## [35] "AGG..ASSAULT..RATE.PERCENT.CHANGE.PER.100.000.PEOPLE" 
## [36] "B...E.RATE.PERCENT.CHANGE.PER.100.000.PEOPLE"         
## [37] "LARCENY.THEFT..RATE.PERCENT.CHANGE.PER.100.000.PEOPLE"
## [38] "M.V.THEFT..RATE.PERCENT.CHANGE.PER.100.000.PEOPLE"

##Select columns to analyse

MDcrime_new<-select(MDcrime,JURISDICTION,YEAR,MURDER,ROBBERY,AGGASSAULT,BE,MotorvehicleTHEFT,violentcrimetotal,violentcrimerateper_100000,murderper100000,robberyper100000)

##Lets review the DIM and STR of the new dataframe

dim(MDcrime_new)
## [1] 1008   11
str(MDcrime_new)
## 'data.frame':    1008 obs. of  11 variables:
##  $ JURISDICTION              : Factor w/ 26 levels "Allegany County",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ YEAR                      : Factor w/ 42 levels "1/1/1975","1/1/1976",..: 1 2 3 4 5 6 7 8 9 10 ...
##  $ MURDER                    : int  3 2 3 1 1 2 11 1 5 2 ...
##  $ ROBBERY                   : int  20 24 32 18 18 26 24 18 19 6 ...
##  $ AGGASSAULT                : int  114 59 85 81 84 79 101 80 89 67 ...
##  $ BE                        : int  669 581 592 539 502 541 539 447 347 361 ...
##  $ MotorvehicleTHEFT         : int  93 73 102 100 99 108 88 55 67 68 ...
##  $ violentcrimetotal         : int  142 87 127 102 110 119 149 117 122 90 ...
##  $ violentcrimerateper_100000: num  178 104 155 128 138 ...
##  $ murderper100000           : num  3.8 2.4 3.7 1.3 1.3 2.5 13.5 1.2 6.1 2.5 ...
##  $ robberyper100000          : num  25.1 28.6 39 22.5 22.6 32.3 29.3 22 23 7.4 ...

##Lets view the new dataframe

head(MDcrime_new)
##      JURISDICTION     YEAR MURDER ROBBERY AGGASSAULT  BE MotorvehicleTHEFT
## 1 Allegany County 1/1/1975      3      20        114 669                93
## 2 Allegany County 1/1/1976      2      24         59 581                73
## 3 Allegany County 1/1/1977      3      32         85 592               102
## 4 Allegany County 1/1/1978      1      18         81 539               100
## 5 Allegany County 1/1/1979      1      18         84 502                99
## 6 Allegany County 1/1/1980      2      26         79 541               108
##   violentcrimetotal violentcrimerateper_100000 murderper100000
## 1               142                      178.3             3.8
## 2                87                      103.7             2.4
## 3               127                      154.7             3.7
## 4               102                      127.6             1.3
## 5               110                      138.0             1.3
## 6               119                      147.9             2.5
##   robberyper100000
## 1             25.1
## 2             28.6
## 3             39.0
## 4             22.5
## 5             22.6
## 6             32.3

##Now lets look at columns from Jurisdiction to Robbery

head(select(MDcrime_new, JURISDICTION:ROBBERY))
##      JURISDICTION     YEAR MURDER ROBBERY
## 1 Allegany County 1/1/1975      3      20
## 2 Allegany County 1/1/1976      2      24
## 3 Allegany County 1/1/1977      3      32
## 4 Allegany County 1/1/1978      1      18
## 5 Allegany County 1/1/1979      1      18
## 6 Allegany County 1/1/1980      2      26

##Now lets look at all columns without the BE column

head(select(MDcrime_new, -(JURISDICTION)))
##       YEAR MURDER ROBBERY AGGASSAULT  BE MotorvehicleTHEFT
## 1 1/1/1975      3      20        114 669                93
## 2 1/1/1976      2      24         59 581                73
## 3 1/1/1977      3      32         85 592               102
## 4 1/1/1978      1      18         81 539               100
## 5 1/1/1979      1      18         84 502                99
## 6 1/1/1980      2      26         79 541               108
##   violentcrimetotal violentcrimerateper_100000 murderper100000
## 1               142                      178.3             3.8
## 2                87                      103.7             2.4
## 3               127                      154.7             3.7
## 4               102                      127.6             1.3
## 5               110                      138.0             1.3
## 6               119                      147.9             2.5
##   robberyper100000
## 1             25.1
## 2             28.6
## 3             39.0
## 4             22.5
## 5             22.6
## 6             32.3

##Now lets look at the years with murders greater than 10 and Robberies greater than 20

MDcrime_newx<-filter(MDcrime_new,MURDER>10 & ROBBERY>20)
(MDcrime_newx)
##               JURISDICTION     YEAR MURDER ROBBERY AGGASSAULT    BE
## 1          Allegany County 1/1/1981     11      24        101   539
## 2      Anne Arundel County 1/1/1975     16     413       1514  5662
## 3      Anne Arundel County 1/1/1977     16     396        656  5091
## 4      Anne Arundel County 1/1/1978     17     349        710  4694
## 5      Anne Arundel County 1/1/1979     13     301        728  4430
## 6      Anne Arundel County 1/1/1980     20     352        815  5444
## 7      Anne Arundel County 1/1/1981     23     488        820  5105
## 8      Anne Arundel County 1/1/1982     19     420        844  4614
## 9      Anne Arundel County 1/1/1983     13     465        935  4392
## 10     Anne Arundel County 1/1/1984     16     416       1085  4269
## 11     Anne Arundel County 1/1/1985     16     417       1204  4675
## 12     Anne Arundel County 1/1/1986     20     369        979  5382
## 13     Anne Arundel County 1/1/1987     19     383        895  4539
## 14     Anne Arundel County 1/1/1988     18     420        975  4134
## 15     Anne Arundel County 1/1/1989     20     468        895  4009
## 16     Anne Arundel County 1/1/1990     16     462       1017  4329
## 17     Anne Arundel County 1/1/1991     12     643       1067  4259
## 18     Anne Arundel County 1/1/1992     12     655       1177  4205
## 19     Anne Arundel County 1/1/1993     22     647       1394  4029
## 20     Anne Arundel County 1/1/1994     11     692       1287  3644
## 21     Anne Arundel County 1/1/1995     17     763       1081  3498
## 22     Anne Arundel County 1/1/1996     16     771       1267  4003
## 23     Anne Arundel County 1/1/1997     12     580       1416  3817
## 24     Anne Arundel County 1/1/2000     11     646       2610  3147
## 25     Anne Arundel County 1/1/2001     11     736       2932  3206
## 26     Anne Arundel County 1/1/2002     17     754       2742  3191
## 27     Anne Arundel County 1/1/2003     24     753       2633  3107
## 28     Anne Arundel County 1/1/2004     16     767       2403  2986
## 29     Anne Arundel County 1/1/2005     16     865       2198  3122
## 30     Anne Arundel County 1/1/2006     23     943       2091  3420
## 31     Anne Arundel County 1/1/2007     20     910       2048  3412
## 32     Anne Arundel County 1/1/2008     18     810       1994  3419
## 33     Anne Arundel County 1/1/2009     16     746       2063  3067
## 34     Anne Arundel County 1/1/2010     18     661       2137  2860
## 35     Anne Arundel County 1/1/2011     15     597       1972  2259
## 36     Anne Arundel County 1/1/2012     13     538       1630  2585
## 37     Anne Arundel County 1/1/2013     15     630       1603  2522
## 38     Anne Arundel County 1/1/2014     14     634       1523  2152
## 39    Anne Arundel County  1/1/2015     17     613       1425  2084
## 40       Montgomery County 1/1/1975     21     651        367  5860
## 41    Anne Arundel County  1/1/2016     25     558       1575  1979
## 42          Baltimore City 1/1/1975    259    9055       6309 15787
## 43          Baltimore City 1/1/1976    200    7764       5788 15443
## 44          Baltimore City 1/1/1977    171    7574       6075 15463
## 45          Baltimore City 1/1/1978    199    8103       5849 15969
## 46          Baltimore City 1/1/1979    245    8492       6247 17054
## 47          Baltimore City 1/1/1980    216   10046       5805 17774
## 48          Baltimore City 1/1/1981    228   10737       6258 18604
## 49          Baltimore City 1/1/1982    227    9357       6592 16501
## 50          Baltimore City 1/1/1983    201    9176       6291 14690
## 51          Baltimore City 1/1/1984    215    8017       6830 14062
## 52          Baltimore City 1/1/1985    213    7794       6949 13988
## 53          Baltimore City 1/1/1986    240    8008       6369 14388
## 54          Baltimore City 1/1/1987    226    7485       6030 13558
## 55          Baltimore City 1/1/1988    237    7418       6592 14359
## 56          Baltimore City 1/1/1989    259    7986       6876 14446
## 57          Baltimore City 1/1/1990    305    9491       7519 14867
## 58          Baltimore City 1/1/1991    304   10793       7295 16394
## 59          Baltimore City 1/1/1992    335   12290       8481 16503
## 60          Baltimore City 1/1/1993    353   12408       8577 18076
## 61          Baltimore City 1/1/1994    321   11303       8748 16026
## 62          Baltimore City 1/1/1995    325   11397       9172 16705
## 63          Baltimore City 1/1/1996    333   10429       8216 14887
## 64          Baltimore City 1/1/1997    313    8665       8072 12841
## 65          Baltimore City 1/1/1998    315    7718       7605 13279
## 66          Baltimore City 1/1/1999    305    7462      10536 12386
## 67          Baltimore City 1/1/2000    261    6634       8774 10751
## 68          Baltimore City 1/1/2001    256    5762       8520 10960
## 69          Baltimore City 1/1/2002    253    4764       8667  8814
## 70          Baltimore City 1/1/2003    270    4364       6385  7855
## 71          Baltimore City 1/1/2004    276    4085       7199  8022
## 72          Baltimore City 1/1/2005    269    3935       6943  7388
## 73          Baltimore City 1/1/2006    276    4260       6196  7664
## 74          Baltimore City 1/1/2007    282    3926       5875  7431
## 75          Baltimore City 1/1/2008    234    4058       5703  7880
## 76          Baltimore City 1/1/2009    238    3726       5579  7856
## 77          Baltimore City 1/1/2010    223    3361       5502  7646
## 78          Baltimore City 1/1/2011    197    3485       4905  8649
## 79          Baltimore City 1/1/2012    216    3635       4657  7796
## 80          Baltimore City 1/1/2013    233    3755       4471  7440
## 81          Baltimore City 1/1/2014    211    3740       4236  6966
## 82          Baltimore City 1/1/2015    344    4378       4671  7803
## 83          Baltimore City 1/1/2016    318    5288       5210  7399
## 84        Baltimore County 1/1/1975     27     787        503  8312
## 85        Baltimore County 1/1/1976     22     730       1095  8205
## 86        Baltimore County 1/1/1977     26     751       3229  8868
## 87        Baltimore County 1/1/1978     29     846       3755  9001
## 88        Baltimore County 1/1/1979     23    1085       3945 10138
## 89        Baltimore County 1/1/1980     26    1223       4456 11793
## 90        Baltimore County 1/1/1981     32    1401       4580 11964
## 91        Baltimore County 1/1/1982     34    1242       5155  9981
## 92        Baltimore County 1/1/1983     34    1272       4627  8923
## 93        Baltimore County 1/1/1984     28    1087       4900  8727
## 94        Baltimore County 1/1/1985     24    1092       5592  8617
## 95        Baltimore County 1/1/1986     31    1394       5289  9612
## 96        Baltimore County 1/1/1987     32    1419       3995  8490
## 97        Baltimore County 1/1/1988     24    1661       4714  8703
## 98        Baltimore County 1/1/1989     33    1810       5240  8468
## 99        Baltimore County 1/1/1990     34    1709       5000  7996
## 100       Baltimore County 1/1/1991     24    2151       5221  8308
## 101       Baltimore County 1/1/1992     43    2307       5090  8322
## 102       Baltimore County 1/1/1993     36    2311       4864  8050
## 103       Baltimore County 1/1/1994     31    2180       4761  7353
## 104       Baltimore County 1/1/1995     38    2473       4935  7637
## 105       Baltimore County 1/1/1996     34    2427       4690  6972
## 106       Baltimore County 1/1/1997     23    2482       4572  7266
## 107       Baltimore County 1/1/1998     20    1878       4005  6993
## 108       Baltimore County 1/1/1999     30    1708       4171  6194
## 109       Baltimore County 1/1/2000     33    1587       4340  5586
## 110       Baltimore County 1/1/2001     31    1728       4576  6246
## 111       Baltimore County 1/1/2002     29    1705       4589  5719
## 112       Baltimore County 1/1/2003     31    1611       4356  5425
## 113       Baltimore County 1/1/2004     29    1565       4388  4942
## 114       Baltimore County 1/1/2005     40    1769       3663  4629
## 115       Baltimore County 1/1/2006     35    2090       3445  4812
## 116       Baltimore County 1/1/2007     36    1787       3407  4949
## 117       Baltimore County 1/1/2008     31    1730       3018  4448
## 118       Baltimore County 1/1/2009     32    1471       2898  4316
## 119       Baltimore County 1/1/2010     20    1341       2862  4119
## 120       Baltimore County 1/1/2011     30    1457       2654  4295
## 121       Baltimore County 1/1/2012     23    1368       2643  4079
## 122       Baltimore County 1/1/2013     20    1511       2544  3949
## 123       Baltimore County 1/1/2014     25    1512       2405  3493
## 124       Baltimore County 1/1/2015     32    1525       2626  3587
## 125       Baltimore County 1/1/2016     35    1498       2564  3695
## 126         Charles County 1/1/1996     11     116        477   838
## 127         Harford County 1/1/1989     11     105        416  1422
## 128      Montgomery County 1/1/1976     28     638        360  5584
## 129      Montgomery County 1/1/1977     15     520        462  5766
## 130      Montgomery County 1/1/1978     12     595        598  5932
## 131      Montgomery County 1/1/1979     17     606        670  6522
## 132      Montgomery County 1/1/1980     17     852        553  8348
## 133      Montgomery County 1/1/1981     13     955        733  7135
## 134      Montgomery County 1/1/1982     20     729        879  5960
## 135      Montgomery County 1/1/1983     16     665        716  5047
## 136      Montgomery County 1/1/1984     14     636        845  5112
## 137      Montgomery County 1/1/1985     12     728        892  5430
## 138      Montgomery County 1/1/1987     17     738        928  5338
## 139      Montgomery County 1/1/1988     19     812        973  5529
## 140      Montgomery County 1/1/1989     21     866        900  4505
## 141      Montgomery County 1/1/1990     25     863       1106  4973
## 142      Montgomery County 1/1/1991     26    1045       1281  5263
## 143      Montgomery County 1/1/1992     21     993       1296  4971
## 144      Montgomery County 1/1/1993     30     903       1135  4648
## 145      Montgomery County 1/1/1994     34     937       1145  4625
## 146      Montgomery County 1/1/1995     21    1088       1190  4817
## 147      Montgomery County 1/1/1996     13    1038       1075  4670
## 148      Montgomery County 1/1/1997     23     913       1171  4144
## 149      Montgomery County 1/1/1998     13     796       1038  4218
## 150      Montgomery County 1/1/1999     13     713        830  3873
## 151      Montgomery County 1/1/2000     12     813        871  3777
## 152      Montgomery County 1/1/2001     19     895        912  3707
## 153      Montgomery County 1/1/2002     32     977        950  3996
## 154      Montgomery County 1/1/2003     23    1076       1015  4273
## 155      Montgomery County 1/1/2004     18     856       1037  3893
## 156      Montgomery County 1/1/2005     21    1109        909  3729
## 157      Montgomery County 1/1/2006     19    1261        879  3932
## 158      Montgomery County 1/1/2007     20    1189        865  3708
## 159      Montgomery County 1/1/2008     21    1192        882  3760
## 160      Montgomery County 1/1/2009     13    1062        957  3142
## 161      Montgomery County 1/1/2010     16     975        683  3486
## 162      Montgomery County 1/1/2011     15     878        681  3203
## 163      Montgomery County 1/1/2012     14     878        876  2685
## 164      Montgomery County 1/1/2014     18     661        934  2442
## 165      Montgomery County 1/1/2015     29     641       1087  1946
## 166      Montgomery County 1/1/2016     15     698        783  1961
## 167 Prince George's County 1/1/1975     52    2445       2024 11342
## 168 Prince George's County 1/1/1976     38    2205       1962 11448
## 169 Prince George's County 1/1/1977     54    2204       1915 11939
## 170 Prince George's County 1/1/1978     37    2295       2022 12325
## 171 Prince George's County 1/1/1979     51    2613       2314 12417
## 172 Prince George's County 1/1/1980     56    3314       2261 14298
## 173 Prince George's County 1/1/1981     61    3841       2185 14643
## 174 Prince George's County 1/1/1982     76    2998       2257 12622
## 175 Prince George's County 1/1/1983     58    2742       2305 10323
## 176 Prince George's County 1/1/1984     42    2400       2576  9784
## 177 Prince George's County 1/1/1985     47    2567       2944 10156
## 178 Prince George's County 1/1/1986     52    2441       3329 10028
## 179 Prince George's County 1/1/1987     94    2574       3444 10065
## 180 Prince George's County 1/1/1988    101    2856       3532 10190
## 181 Prince George's County 1/1/1989    122    3517       3468  9981
## 182 Prince George's County 1/1/1990    112    4033       3879  9989
## 183 Prince George's County 1/1/1991    147    4227       3837  9838
## 184 Prince George's County 1/1/1992    134    3786       3917  9882
## 185 Prince George's County 1/1/1993    141    4400       3993 10323
## 186 Prince George's County 1/1/1994    127    3984       3815 10352
## 187 Prince George's County 1/1/1995    137    4403       4031 10231
## 188 Prince George's County 1/1/1996    142    4078       4499  9319
## 189 Prince George's County 1/1/1997     83    3263       3579  9203
## 190 Prince George's County 1/1/1998    107    3146       4310  8913
## 191 Prince George's County 1/1/1999     95    2474       3827  7985
## 192 Prince George's County 1/1/2000     72    2937       4172  7042
## 193 Prince George's County 1/1/2001    109    3916       3974  8914
## 194 Prince George's County 1/1/2002    141    4056       4007  8561
## 195 Prince George's County 1/1/2003    135    4148       3439  8483
## 196 Prince George's County 1/1/2004    146    4100       3649  7460
## 197 Prince George's County 1/1/2005    164    5172       3856  7445
## 198 Prince George's County 1/1/2006    130    4094       3970  6903
## 199 Prince George's County 1/1/2007    141    3831       3276  7188
## 200 Prince George's County 1/1/2008    122    3765       3263  8209
## 201 Prince George's County 1/1/2009     96    3324       2980  8219
## 202 Prince George's County 1/1/2010     91    3126       2781  8055
## 203 Prince George's County 1/1/2011     95    2545       2346  6985
## 204 Prince George's County 1/1/2012     63    2450       2260  6046
## 205 Prince George's County 1/1/2013     56    2012       2246  5733
## 206 Prince George's County 1/1/2014     56    1846       2020  4767
## 207 Prince George's County 1/1/2015     78    1704       2079  3667
## 208 Prince George's County 1/1/2016     88    1534       1620  2951
## 209        Wicomico County 1/1/1980     13      64        156  1082
##     MotorvehicleTHEFT violentcrimetotal violentcrimerateper_100000
## 1                  88               149                      182.2
## 2                1986              2017                      608.6
## 3                1436              1186                      341.3
## 4                1161              1144                      315.0
## 5                1264              1126                      311.3
## 6                1353              1304                      352.3
## 7                1276              1416                      376.4
## 8                1128              1366                      362.8
## 9                 951              1484                      390.6
## 10                941              1614                      415.3
## 11               1121              1750                      445.6
## 12               1533              1501                      376.1
## 13               1676              1412                      342.3
## 14               1801              1496                      354.0
## 15               1805              1507                      355.3
## 16               2197              1626                      380.6
## 17               2084              1848                      425.6
## 18               2101              1980                      451.5
## 19               1854              2204                      494.4
## 20               1806              2122                      472.1
## 21               1863              1972                      429.2
## 22               1797              2140                      463.0
## 23               1760              2098                      452.0
## 24               1398              3384                      691.1
## 25               1258              3798                      764.3
## 26               1484              3607                      714.8
## 27               1441              3503                      689.5
## 28               1631              3296                      644.8
## 29               1524              3167                      618.0
## 30               1654              3167                      618.2
## 31               1667              3068                      603.7
## 32               1581              2931                      573.4
## 33               1134              2920                      564.0
## 34               1236              2929                      555.5
## 35                832              2675                      492.9
## 36                888              2281                      415.0
## 37                677              2319                      417.6
## 38                702              2263                      403.4
## 39                629              2195                      389.3
## 40               2029              1131                      197.9
## 41                622              2312                      408.4
## 42               7602             16086                     1861.6
## 43               5903             14212                     1650.7
## 44               6213             14319                     1730.4
## 45               5909             14705                     1881.1
## 46               6807             15549                     1966.0
## 47               5661             16633                     2120.1
## 48               5331             17789                     2230.8
## 49               4462             16729                     2095.9
## 50               4470             16168                     2007.1
## 51               5419             15628                     1981.7
## 52               6027             15550                     2016.6
## 53               6884             15277                     1949.7
## 54               7495             14336                     1874.2
## 55               8468             14766                     1933.0
## 56               8188             15664                     2052.6
## 57               9939             18006                     2446.4
## 58              10618             19094                     2552.3
## 59              11332             21860                     2893.4
## 60              10672             22006                     3002.3
## 61              13603             21011                     2842.5
## 62              11210             21578                     3029.7
## 63              11186             19621                     2738.7
## 64               8856             17530                     2436.1
## 65               7375             16108                     2432.3
## 66               7255             18677                     2870.8
## 67               7871             16035                     2462.6
## 68               8199             14837                     2245.2
## 69               6572             13863                     2065.9
## 70               6874             11227                     1741.8
## 71               6731             11742                     1851.2
## 72               6232             11309                     1764.0
## 73               6276             10871                     1705.1
## 74               5821             10229                     1638.6
## 75               5518             10132                     1596.7
## 76               4632              9701                     1518.7
## 77               4421              9352                     1461.4
## 78               4207              8928                     1424.3
## 79               3987              8825                     1410.9
## 80               4462              8757                     1406.4
## 81               4504              8432                     1352.3
## 82               5541              9680                     1558.1
## 83               5336             11115                     1797.4
## 84               2992              1470                      228.9
## 85               2834              2002                      311.7
## 86               2892              4175                      648.9
## 87               2720              4815                      751.0
## 88               3306              5249                      820.3
## 89               3287              5895                      905.1
## 90               3203              6205                      937.3
## 91               2941              6597                      995.6
## 92               2774              6083                      909.7
## 93               2775              6191                      921.8
## 94               3064              6891                     1013.8
## 95               3691              6914                     1001.1
## 96               3863              5653                      830.0
## 97               4606              6593                      951.8
## 98               4480              7308                     1043.9
## 99               5098              7005                     1012.1
## 100              5913              7674                     1090.7
## 101              5619              7743                     1089.8
## 102              5477              7494                     1052.5
## 103              6289              7260                     1011.3
## 104              5406              7697                     1073.6
## 105              4751              7427                     1029.8
## 106              4185              7333                     1012.4
## 107              3367              6129                      843.7
## 108              2953              6099                      838.9
## 109              3418              6200                      822.0
## 110              3297              6572                      858.5
## 111              3491              6559                      843.8
## 112              3341              6208                      798.5
## 113              2936              6180                      788.1
## 114              3046              5650                      718.1
## 115              3463              5713                      724.8
## 116              3372              5381                      685.0
## 117              2940              4931                      626.1
## 118              2443              4555                      574.5
## 119              1880              4349                      545.1
## 120              1710              4288                      527.6
## 121              1572              4181                      511.3
## 122              1463              4200                      510.4
## 123              1499              4042                      487.7
## 124              1770              4517                      544.5
## 125              2070              4416                      531.2
## 126               420               646                      583.4
## 127               317               570                      329.4
## 128              1655              1122                      196.7
## 129              1739              1117                      194.2
## 130              1731              1327                      227.8
## 131              2163              1430                      247.9
## 132              1938              1573                      274.0
## 133              2000              1868                      320.1
## 134              1687              1801                      308.4
## 135              1401              1529                      259.4
## 136              1601              1641                      271.1
## 137              1986              1759                      279.2
## 138              2640              1856                      274.6
## 139              3218              1988                      283.0
## 140              3010              1987                      277.5
## 141              3023              2198                      290.3
## 142              3378              2572                      334.3
## 143              3134              2499                      321.6
## 144              3159              2280                      289.1
## 145              3370              2315                      291.1
## 146              3388              2521                      311.8
## 147              3329              2286                      281.1
## 148              3226              2296                      279.3
## 149              2815              2014                      241.7
## 150              2667              1692                      199.8
## 151              2904              1873                      214.5
## 152              3353              1972                      222.5
## 153              3958              2104                      233.8
## 154              3676              2262                      246.2
## 155              2730              2060                      222.2
## 156              2671              2196                      236.5
## 157              2640              2304                      247.7
## 158              2634              2207                      236.6
## 159              2384              2231                      236.6
## 160              1824              2162                      224.3
## 161              1530              1797                      182.0
## 162              1278              1689                      172.2
## 163              1073              1874                      187.5
## 164               753              1738                      168.9
## 165               768              2032                      195.1
## 166               872              1834                      175.1
## 167              4722              4809                      706.8
## 168              4172              4513                      657.9
## 169              3521              4470                      661.7
## 170              4044              4703                      700.5
## 171              4466              5371                      809.9
## 172              4458              6058                      921.1
## 173              4565              6497                      971.9
## 174              4587              5706                      852.8
## 175              4321              5446                      806.5
## 176              4574              5415                      794.4
## 177              5920              5924                      868.3
## 178              7324              6251                      901.7
## 179              7921              6571                      949.1
## 180             10035              6909                      982.9
## 181             10391              7409                     1040.7
## 182             10199              8517                     1167.9
## 183              9973              8712                     1175.3
## 184             10210              8289                     1107.3
## 185              9344              8993                     1186.5
## 186              9477              8339                     1091.3
## 187             10864              8976                     1173.0
## 188             11644              9063                     1177.4
## 189              9287              7272                      947.0
## 190              9836              7868                     1012.8
## 191              8619              6661                      850.3
## 192              9881              7409                      924.4
## 193             13670              8254                     1014.7
## 194             16991              8478                     1026.4
## 195             17628              8009                      952.5
## 196             18482              8188                      967.6
## 197             17242              9497                     1118.1
## 198             12944              8481                      999.6
## 199             11646              7515                      893.3
## 200              9743              7400                      895.8
## 201              7266              6621                      800.7
## 202              6700              6202                      736.1
## 203              5943              5169                      593.0
## 204              5092              4946                      562.3
## 205              4293              4490                      505.6
## 206              4278              4128                      459.7
## 207              3431              4139                      454.1
## 208              3371              3519                      385.3
## 209               156               248                      381.7
##     murderper100000 robberyper100000
## 1              13.5             29.3
## 2               4.8            124.6
## 3               4.6            113.9
## 4               4.7             96.1
## 5               3.6             83.2
## 6               5.4             95.1
## 7               6.1            129.7
## 8               5.0            111.5
## 9               3.4            122.4
## 10              4.1            107.0
## 11              4.1            106.2
## 12              5.0             92.5
## 13              4.6             92.8
## 14              4.3             99.4
## 15              4.7            110.3
## 16              3.7            108.1
## 17              2.8            148.1
## 18              2.7            149.4
## 19              4.9            145.1
## 20              2.4            154.0
## 21              3.7            166.1
## 22              3.5            166.8
## 23              2.6            124.9
## 24              2.2            131.9
## 25              2.2            148.1
## 26              3.4            149.4
## 27              4.7            148.2
## 28              3.1            150.1
## 29              3.1            168.8
## 30              4.5            184.1
## 31              3.9            179.1
## 32              3.5            158.5
## 33              3.1            144.1
## 34              3.4            125.4
## 35              2.8            110.0
## 36              2.4             97.9
## 37              2.7            113.4
## 38              2.5            113.0
## 39              3.0            108.7
## 40              3.7            113.9
## 41              4.4             98.6
## 42             30.0           1047.9
## 43             23.2            901.8
## 44             20.7            915.3
## 45             25.5           1036.5
## 46             31.0           1073.7
## 47             27.5           1280.5
## 48             28.6           1346.5
## 49             28.4           1172.3
## 50             25.0           1139.1
## 51             27.3           1016.6
## 52             27.6           1010.8
## 53             30.6           1022.0
## 54             29.5            978.6
## 55             31.0            971.1
## 56             33.9           1046.5
## 57             41.4           1289.5
## 58             40.6           1442.7
## 59             44.3           1626.7
## 60             48.2           1692.8
## 61             43.4           1529.1
## 62             45.6           1600.2
## 63             46.5           1455.7
## 64             43.5           1204.2
## 65             47.6           1165.4
## 66             46.9           1147.0
## 67             40.1           1018.8
## 68             38.7            871.9
## 69             37.7            710.0
## 70             41.9            677.1
## 71             43.5            644.0
## 72             42.0            613.8
## 73             43.3            668.2
## 74             45.2            628.9
## 75             36.9            639.5
## 76             37.3            583.3
## 77             34.8            525.2
## 78             31.4            556.0
## 79             34.5            581.2
## 80             37.4            603.0
## 81             33.8            599.8
## 82             55.4            704.7
## 83             51.4            855.1
## 84              4.2            122.6
## 85              3.4            113.6
## 86              4.0            116.7
## 87              4.5            132.0
## 88              3.6            169.6
## 89              4.0            187.8
## 90              4.8            211.6
## 91              5.1            187.4
## 92              5.1            190.2
## 93              4.2            161.9
## 94              3.5            160.7
## 95              4.5            201.8
## 96              4.7            208.3
## 97              3.5            239.8
## 98              4.7            258.5
## 99              4.9            246.9
## 100             3.4            305.7
## 101             6.1            324.7
## 102             5.1            324.6
## 103             4.3            303.7
## 104             5.3            345.0
## 105             4.7            336.5
## 106             3.2            342.7
## 107             2.8            258.5
## 108             4.1            234.9
## 109             4.4            210.4
## 110             4.0            225.7
## 111             3.7            219.3
## 112             4.0            207.2
## 113             3.7            199.6
## 114             5.1            224.8
## 115             4.4            265.1
## 116             4.6            227.5
## 117             3.9            219.7
## 118             4.0            185.5
## 119             2.5            168.1
## 120             3.7            179.3
## 121             2.8            167.3
## 122             2.4            183.6
## 123             3.0            182.4
## 124             3.9            183.8
## 125             4.2            180.2
## 126             9.9            104.8
## 127             6.4             60.7
## 128             4.9            111.9
## 129             2.6             90.4
## 130             2.1            102.2
## 131             2.9            105.1
## 132             3.0            148.4
## 133             2.2            163.7
## 134             3.4            124.8
## 135             2.7            112.8
## 136             2.3            105.1
## 137             1.9            115.5
## 138             2.5            109.2
## 139             2.7            115.6
## 140             2.9            121.0
## 141             3.3            114.0
## 142             3.4            135.8
## 143             2.7            127.8
## 144             3.8            114.5
## 145             4.3            117.8
## 146             2.6            134.6
## 147             1.6            127.6
## 148             2.8            111.1
## 149             1.6             95.5
## 150             1.5             84.2
## 151             1.4             93.1
## 152             2.1            101.0
## 153             3.6            108.6
## 154             2.5            117.1
## 155             1.9             92.3
## 156             2.3            119.4
## 157             2.0            135.6
## 158             2.1            127.5
## 159             2.2            126.4
## 160             1.3            110.2
## 161             1.6             98.8
## 162             1.5             89.5
## 163             1.4             87.9
## 164             1.7             64.2
## 165             2.8             61.6
## 166             1.4             66.6
## 167             7.6            359.4
## 168             5.5            321.5
## 169             8.0            326.3
## 170             5.5            341.9
## 171             7.7            394.0
## 172             8.5            503.9
## 173             9.1            574.6
## 174            11.4            448.0
## 175             8.6            406.1
## 176             6.2            352.1
## 177             6.9            376.3
## 178             7.5            352.1
## 179            13.6            371.8
## 180            14.4            406.3
## 181            17.1            494.0
## 182            15.4            553.0
## 183            19.8            570.3
## 184            17.9            505.8
## 185            18.6            580.5
## 186            16.6            521.4
## 187            17.9            575.4
## 188            18.4            529.8
## 189            10.8            424.9
## 190            13.8            405.0
## 191            12.1            315.8
## 192             9.0            366.4
## 193            13.4            481.4
## 194            17.1            491.1
## 195            16.1            493.3
## 196            17.3            484.5
## 197            19.3            608.9
## 198            15.3            482.5
## 199            16.8            455.4
## 200            14.8            455.8
## 201            11.6            402.0
## 202            10.8            371.0
## 203            10.9            292.0
## 204             7.2            278.5
## 205             6.3            226.6
## 206             6.2            205.6
## 207             8.6            186.9
## 208             9.6            168.0
## 209            20.0             98.5

##Lets Rename the BE column

MDcrime_new<-rename(MDcrime_new, breakingANDentering = BE)
head(MDcrime_new)
##      JURISDICTION     YEAR MURDER ROBBERY AGGASSAULT breakingANDentering
## 1 Allegany County 1/1/1975      3      20        114                 669
## 2 Allegany County 1/1/1976      2      24         59                 581
## 3 Allegany County 1/1/1977      3      32         85                 592
## 4 Allegany County 1/1/1978      1      18         81                 539
## 5 Allegany County 1/1/1979      1      18         84                 502
## 6 Allegany County 1/1/1980      2      26         79                 541
##   MotorvehicleTHEFT violentcrimetotal violentcrimerateper_100000
## 1                93               142                      178.3
## 2                73                87                      103.7
## 3               102               127                      154.7
## 4               100               102                      127.6
## 5                99               110                      138.0
## 6               108               119                      147.9
##   murderper100000 robberyper100000
## 1             3.8             25.1
## 2             2.4             28.6
## 3             3.7             39.0
## 4             1.3             22.5
## 5             1.3             22.6
## 6             2.5             32.3

##Subsetting: Lets view Montgomery county crime

MDcrime_new<-filter(MDcrime_new, JURISDICTION == "Montgomery County")
head(MDcrime_new, 42)
##         JURISDICTION     YEAR MURDER ROBBERY AGGASSAULT
## 1  Montgomery County 1/1/1975     21     651        367
## 2  Montgomery County 1/1/1976     28     638        360
## 3  Montgomery County 1/1/1977     15     520        462
## 4  Montgomery County 1/1/1978     12     595        598
## 5  Montgomery County 1/1/1979     17     606        670
## 6  Montgomery County 1/1/1980     17     852        553
## 7  Montgomery County 1/1/1981     13     955        733
## 8  Montgomery County 1/1/1982     20     729        879
## 9  Montgomery County 1/1/1983     16     665        716
## 10 Montgomery County 1/1/1984     14     636        845
## 11 Montgomery County 1/1/1985     12     728        892
## 12 Montgomery County 1/1/1986      8     695        900
## 13 Montgomery County 1/1/1987     17     738        928
## 14 Montgomery County 1/1/1988     19     812        973
## 15 Montgomery County 1/1/1989     21     866        900
## 16 Montgomery County 1/1/1990     25     863       1106
## 17 Montgomery County 1/1/1991     26    1045       1281
## 18 Montgomery County 1/1/1992     21     993       1296
## 19 Montgomery County 1/1/1993     30     903       1135
## 20 Montgomery County 1/1/1994     34     937       1145
## 21 Montgomery County 1/1/1995     21    1088       1190
## 22 Montgomery County 1/1/1996     13    1038       1075
## 23 Montgomery County 1/1/1997     23     913       1171
## 24 Montgomery County 1/1/1998     13     796       1038
## 25 Montgomery County 1/1/1999     13     713        830
## 26 Montgomery County 1/1/2000     12     813        871
## 27 Montgomery County 1/1/2001     19     895        912
## 28 Montgomery County 1/1/2002     32     977        950
## 29 Montgomery County 1/1/2003     23    1076       1015
## 30 Montgomery County 1/1/2004     18     856       1037
## 31 Montgomery County 1/1/2005     21    1109        909
## 32 Montgomery County 1/1/2006     19    1261        879
## 33 Montgomery County 1/1/2007     20    1189        865
## 34 Montgomery County 1/1/2008     21    1192        882
## 35 Montgomery County 1/1/2009     13    1062        957
## 36 Montgomery County 1/1/2010     16     975        683
## 37 Montgomery County 1/1/2011     15     878        681
## 38 Montgomery County 1/1/2012     14     878        876
## 39 Montgomery County 1/1/2013      9     812        813
## 40 Montgomery County 1/1/2014     18     661        934
## 41 Montgomery County 1/1/2015     29     641       1087
## 42 Montgomery County 1/1/2016     15     698        783
##    breakingANDentering MotorvehicleTHEFT violentcrimetotal
## 1                 5860              2029              1131
## 2                 5584              1655              1122
## 3                 5766              1739              1117
## 4                 5932              1731              1327
## 5                 6522              2163              1430
## 6                 8348              1938              1573
## 7                 7135              2000              1868
## 8                 5960              1687              1801
## 9                 5047              1401              1529
## 10                5112              1601              1641
## 11                5430              1986              1759
## 12                5010              2291              1748
## 13                5338              2640              1856
## 14                5529              3218              1988
## 15                4505              3010              1987
## 16                4973              3023              2198
## 17                5263              3378              2572
## 18                4971              3134              2499
## 19                4648              3159              2280
## 20                4625              3370              2315
## 21                4817              3388              2521
## 22                4670              3329              2286
## 23                4144              3226              2296
## 24                4218              2815              2014
## 25                3873              2667              1692
## 26                3777              2904              1873
## 27                3707              3353              1972
## 28                3996              3958              2104
## 29                4273              3676              2262
## 30                3893              2730              2060
## 31                3729              2671              2196
## 32                3932              2640              2304
## 33                3708              2634              2207
## 34                3760              2384              2231
## 35                3142              1824              2162
## 36                3486              1530              1797
## 37                3203              1278              1689
## 38                2685              1073              1874
## 39                2728               913              1769
## 40                2442               753              1738
## 41                1946               768              2032
## 42                1961               872              1834
##    violentcrimerateper_100000 murderper100000 robberyper100000
## 1                       197.9             3.7            113.9
## 2                       196.7             4.9            111.9
## 3                       194.2             2.6             90.4
## 4                       227.8             2.1            102.2
## 5                       247.9             2.9            105.1
## 6                       274.0             3.0            148.4
## 7                       320.1             2.2            163.7
## 8                       308.4             3.4            124.8
## 9                       259.4             2.7            112.8
## 10                      271.1             2.3            105.1
## 11                      279.2             1.9            115.5
## 12                      273.0             1.2            108.5
## 13                      274.6             2.5            109.2
## 14                      283.0             2.7            115.6
## 15                      277.5             2.9            121.0
## 16                      290.3             3.3            114.0
## 17                      334.3             3.4            135.8
## 18                      321.6             2.7            127.8
## 19                      289.1             3.8            114.5
## 20                      291.1             4.3            117.8
## 21                      311.8             2.6            134.6
## 22                      281.1             1.6            127.6
## 23                      279.3             2.8            111.1
## 24                      241.7             1.6             95.5
## 25                      199.8             1.5             84.2
## 26                      214.5             1.4             93.1
## 27                      222.5             2.1            101.0
## 28                      233.8             3.6            108.6
## 29                      246.2             2.5            117.1
## 30                      222.2             1.9             92.3
## 31                      236.5             2.3            119.4
## 32                      247.7             2.0            135.6
## 33                      236.6             2.1            127.5
## 34                      236.6             2.2            126.4
## 35                      224.3             1.3            110.2
## 36                      182.0             1.6             98.8
## 37                      172.2             1.5             89.5
## 38                      187.5             1.4             87.9
## 39                      174.0             0.9             79.9
## 40                      168.9             1.7             64.2
## 41                      195.1             2.8             61.6
## 42                      175.1             1.4             66.6