Loading data

We got this data from http://data.hartford.gov/

correction <- read_csv("Correctional_Facility_Daily_Population_Count_By_Facility.csv")

correction <- correction %>%
  rename(name = `Facility Name`) %>%
  rename(accused = `Accused/Other Status Count`) %>%
  rename(sentenced = `Sentenced Status Count`) %>%
  rename(total = `Total Facility Population Count`) %>%
  mutate(Date = mdy(Date))

Where are the most accused?

correction %>%
  df_stats(accused~name, mean) %>%
  arrange(desc(mean_accused))
##                   name mean_accused
## 1          HARTFORD CC 760.17326233
## 2        BRIDGEPORT CC 603.92241300
## 3         NEW HAVEN CC 576.88908273
## 4          CORRIGAN CI 398.67181333
## 5              YORK CI 349.01013125
## 6            WALKER RC 198.43179411
## 7            OSBORN CI 159.13378019
## 8              NIANTIC 143.98761714
## 9               GARNER 137.70524297
## 10           MANSON YI 121.23294463
## 11           MORGAN ST 109.32900081
## 12         NORTHERN CI  89.11250146
## 13          MACDOUGALL  83.53118399
## 14           UNION AVE  72.13440551
## 15      JENNINGS RD DC  71.65614237
## 16           RADGOWSKI  41.28059866
## 17         CHESHIRE CI  34.73041961
## 18                 145  27.50000000
## 19 WILLARD-CYBULSKI CI  26.43879626
## 20          LITCHFIELD  25.29713952
## 21         ROBINSON CI  22.95712056
## 22         BROOKLYN CI  18.61325865
## 23       NIANTIC ANNEX  13.29213483
## 24            GATES CI   9.84133511
## 25          ENFIELD CI   9.67642140
## 26          WEBSTER CI   3.65321546
## 27           BERGIN CI   3.62180669
## 28       EDDY/DWI UNIT   0.50785855
## 29    HARTELL/DWI UNIT   0.39505155
## 30            CYBULSKI   0.06140879
## 31          WILLARD CI   0.01356050
## 32         GREENSVILLE   0.00000000
## 33           HARTELL/F   0.00000000
## 34          MALONEY CI   0.00000000
## 35         W SUB ABUSE   0.00000000
## 36       WALLENS RIDGE   0.00000000

Focus on Hartford

hartford <- correction %>%
  filter(name == "HARTFORD CC")

Plotting

gf_point(accused~Date, data=hartford)

gf_line(accused~Date, data=hartford)

More complicated filtering

I wonder about how Osborn and Enfield look. Let’s filter it.

correction %>%
  filter(name == "OSBORN CI" | name == "ENFIELD CI")
## # A tibble: 21,655 x 5
##    Date       name       accused sentenced total
##    <date>     <chr>        <int>     <int> <int>
##  1 1988-10-01 ENFIELD CI