Final Presentation Source Code

library(tidyverse)
Warning: package 'tidyverse' was built under R version 4.4.2
Warning: package 'forcats' was built under R version 4.4.2
Warning: package 'lubridate' was built under R version 4.4.2
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.5
✔ forcats   1.0.0     ✔ stringr   1.5.1
✔ ggplot2   3.5.1     ✔ tibble    3.2.1
✔ lubridate 1.9.4     ✔ tidyr     1.3.1
✔ purrr     1.0.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(data.table)
Warning: package 'data.table' was built under R version 4.4.2

Attaching package: 'data.table'

The following objects are masked from 'package:lubridate':

    hour, isoweek, mday, minute, month, quarter, second, wday, week,
    yday, year

The following objects are masked from 'package:dplyr':

    between, first, last

The following object is masked from 'package:purrr':

    transpose
library(ggplot2)
library(lubridate)
accidents <- fread("data/traffic_accidents.csv")

accidents_csv <- read.csv("data/traffic_accidents.csv")
head(accidents)
               crash_date traffic_control_device weather_condition
                   <char>                 <char>            <char>
1: 07/29/2023 01:00:00 PM         TRAFFIC SIGNAL             CLEAR
2: 08/13/2023 12:11:00 AM         TRAFFIC SIGNAL             CLEAR
3: 12/09/2021 10:30:00 AM         TRAFFIC SIGNAL             CLEAR
4: 08/09/2023 07:55:00 PM         TRAFFIC SIGNAL             CLEAR
5: 08/19/2023 02:55:00 PM         TRAFFIC SIGNAL             CLEAR
6: 09/06/2023 12:59:00 AM            NO CONTROLS              RAIN
       lighting_condition first_crash_type trafficway_type          alignment
                   <char>           <char>          <char>             <char>
1:               DAYLIGHT          TURNING     NOT DIVIDED STRAIGHT AND LEVEL
2: DARKNESS, LIGHTED ROAD          TURNING        FOUR WAY STRAIGHT AND LEVEL
3:               DAYLIGHT         REAR END  T-INTERSECTION STRAIGHT AND LEVEL
4:               DAYLIGHT            ANGLE        FOUR WAY STRAIGHT AND LEVEL
5:               DAYLIGHT         REAR END  T-INTERSECTION STRAIGHT AND LEVEL
6: DARKNESS, LIGHTED ROAD     FIXED OBJECT     NOT DIVIDED STRAIGHT AND LEVEL
   roadway_surface_cond road_defect                       crash_type
                 <char>      <char>                           <char>
1:              UNKNOWN     UNKNOWN           NO INJURY / DRIVE AWAY
2:                  DRY  NO DEFECTS           NO INJURY / DRIVE AWAY
3:                  DRY  NO DEFECTS           NO INJURY / DRIVE AWAY
4:                  DRY  NO DEFECTS INJURY AND / OR TOW DUE TO CRASH
5:              UNKNOWN     UNKNOWN           NO INJURY / DRIVE AWAY
6:                  WET     UNKNOWN INJURY AND / OR TOW DUE TO CRASH
   intersection_related_i        damage             prim_contributory_cause
                   <char>        <char>                              <char>
1:                      Y $501 - $1,500                 UNABLE TO DETERMINE
2:                      Y   OVER $1,500          IMPROPER TURNING/NO SIGNAL
3:                      Y $501 - $1,500               FOLLOWING TOO CLOSELY
4:                      Y   OVER $1,500                 UNABLE TO DETERMINE
5:                      Y $501 - $1,500 DRIVING SKILLS/KNOWLEDGE/EXPERIENCE
6:                      N $501 - $1,500                 UNABLE TO DETERMINE
   num_units       most_severe_injury injuries_total injuries_fatal
       <int>                   <char>          <num>          <num>
1:         2  NO INDICATION OF INJURY              0              0
2:         2  NO INDICATION OF INJURY              0              0
3:         3  NO INDICATION OF INJURY              0              0
4:         2 NONINCAPACITATING INJURY              5              0
5:         2  NO INDICATION OF INJURY              0              0
6:         1 NONINCAPACITATING INJURY              2              0
   injuries_incapacitating injuries_non_incapacitating
                     <num>                       <num>
1:                       0                           0
2:                       0                           0
3:                       0                           0
4:                       0                           5
5:                       0                           0
6:                       0                           2
   injuries_reported_not_evident injuries_no_indication crash_hour
                           <num>                  <num>      <int>
1:                             0                      3         13
2:                             0                      2          0
3:                             0                      3         10
4:                             0                      0         19
5:                             0                      3         14
6:                             0                      0          0
   crash_day_of_week crash_month
               <int>       <int>
1:                 7           7
2:                 1           8
3:                 5          12
4:                 4           8
5:                 7           8
6:                 4           9
weather <- accidents[, .(injuries_fatal = sum(injuries_fatal),
              injuries_incapacitating = sum(injuries_incapacitating),
              injuries_non_incapacitating = sum(injuries_non_incapacitating),
              injuries_reported_not_evident = sum(injuries_reported_not_evident),
              injuries_no_indication = sum(injuries_no_indication)
), by = weather_condition]

weather[order(-injuries_fatal)]
           weather_condition injuries_fatal injuries_incapacitating
                      <char>          <num>                   <num>
 1:                    CLEAR            323                    6580
 2:                     RAIN             41                     803
 3:          CLOUDY/OVERCAST             13                     249
 4:                  UNKNOWN              6                     100
 5:                     SNOW              3                     162
 6:           FOG/SMOKE/HAZE              1                       5
 7:    FREEZING RAIN/DRIZZLE              1                      21
 8:   SEVERE CROSS WIND GATE              1                       1
 9:             BLOWING SNOW              0                       5
10:                    OTHER              0                      36
11:               SLEET/HAIL              0                      13
12: BLOWING SAND, SOIL, DIRT              0                       0
    injuries_non_incapacitating injuries_reported_not_evident
                          <num>                         <num>
 1:                       37270                         20126
 2:                        5217                          2870
 3:                        1557                           963
 4:                         562                           417
 5:                        1197                           758
 6:                          84                            70
 7:                         152                            61
 8:                           4                             2
 9:                          19                            16
10:                         165                           102
11:                          80                            49
12:                           0                             0
    injuries_no_indication
                     <num>
 1:                 370441
 2:                  48651
 3:                  17091
 4:                  13922
 5:                  15303
 6:                    788
 7:                   1074
 8:                     64
 9:                    292
10:                   1401
11:                    654
12:                      2
accidents[, .(injuries_fatal = sum(injuries_fatal),
              injuries_incapacitating = sum(injuries_incapacitating),
              injuries_non_incapacitating = sum(injuries_non_incapacitating),
              injuries_reported_not_evident = sum(injuries_reported_not_evident),
              injuries_no_indication = sum(injuries_no_indication)
), by = lighting_condition]
       lighting_condition injuries_fatal injuries_incapacitating
                   <char>          <num>                   <num>
1:               DAYLIGHT            154                    4558
2: DARKNESS, LIGHTED ROAD            187                    2632
3:                   DUSK             13                     225
4:               DARKNESS             29                     337
5:                UNKNOWN              1                      60
6:                   DAWN              5                     163
   injuries_non_incapacitating injuries_reported_not_evident
                         <num>                         <num>
1:                       27522                         15962
2:                       14565                          7035
3:                        1330                           784
4:                        1717                           932
5:                         360                           256
6:                         813                           465
   injuries_no_indication
                    <num>
1:                 301499
2:                 120208
3:                  14515
4:                  16334
5:                   9254
6:                   7873
accidents[, .(injuries_fatal = sum(injuries_fatal),
              injuries_incapacitating = sum(injuries_incapacitating),
              injuries_non_incapacitating = sum(injuries_non_incapacitating),
              injuries_reported_not_evident = sum(injuries_reported_not_evident),
              injuries_no_indication = sum(injuries_no_indication)
), by = traffic_control_device]
      traffic_control_device injuries_fatal injuries_incapacitating
                      <char>          <num>                   <num>
 1:           TRAFFIC SIGNAL            247                    4898
 2:              NO CONTROLS             73                    1046
 3:        STOP SIGN/FLASHER             58                    1768
 4:                  UNKNOWN              4                     120
 5:                    OTHER              1                      31
 6: PEDESTRIAN CROSSING SIGN              2                      29
 7:       OTHER WARNING SIGN              0                       5
 8:                    YIELD              2                      26
 9:  FLASHING CONTROL SIGNAL              0                       8
10:         LANE USE MARKING              0                      14
11:          OTHER REG. SIGN              0                      15
12:              DELINEATORS              0                       0
13:              SCHOOL ZONE              1                       4
14:           POLICE/FLAGMAN              0                       5
15:               NO PASSING              0                       2
16:         RR CROSSING SIGN              0                       0
17:   RAILROAD CROSSING GATE              1                       2
18:    BICYCLE CROSSING SIGN              0                       1
19:  OTHER RAILROAD CROSSING              0                       1
    injuries_non_incapacitating injuries_reported_not_evident
                          <num>                         <num>
 1:                       27950                         15299
 2:                        5574                          2994
 3:                       11562                          6510
 4:                         655                           307
 5:                         145                            79
 6:                         100                            48
 7:                          21                            19
 8:                         134                            74
 9:                          57                            21
10:                          16                            26
11:                          30                            20
12:                           4                            10
13:                          21                             5
14:                          23                             2
15:                           3                             1
16:                           1                             2
17:                           7                             8
18:                           3                             2
19:                           1                             7
    injuries_no_indication
                     <num>
 1:                 282611
 2:                  63595
 3:                 109250
 4:                   9533
 5:                   1424
 6:                    397
 7:                    176
 8:                   1015
 9:                    315
10:                    361
11:                    363
12:                     28
13:                     64
14:                    229
15:                     32
16:                     42
17:                    182
18:                     21
19:                     45
hour<- accidents[, .(injuries_fatal = sum(injuries_fatal),
              injuries_incapacitating = sum(injuries_incapacitating),
              injuries_non_incapacitating = sum(injuries_non_incapacitating),
              injuries_reported_not_evident = sum(injuries_reported_not_evident),
              injuries_no_indication = sum(injuries_no_indication)
), by = crash_hour]

hour[order(-injuries_fatal)]
    crash_hour injuries_fatal injuries_incapacitating
         <int>          <num>                   <num>
 1:         21             29                     369
 2:         23             27                     329
 3:          1             27                     228
 4:         17             24                     516
 5:          2             24                     215
 6:         22             21                     377
 7:         19             20                     383
 8:         18             20                     445
 9:         11             19                     384
10:         20             19                     344
11:         15             19                     455
12:          5             18                     142
13:         12             17                     408
14:          3             14                     161
15:          4             13                     136
16:         14             12                     437
17:         13             11                     401
18:         16             11                     438
19:          0             10                     245
20:          8              8                     381
21:          9              8                     317
22:         10              7                     301
23:          7              7                     316
24:          6              4                     247
    crash_hour injuries_fatal injuries_incapacitating
    injuries_non_incapacitating injuries_reported_not_evident
                          <num>                         <num>
 1:                        1924                          1034
 2:                        1702                           697
 3:                        1221                           516
 4:                        3075                          1932
 5:                        1097                           448
 6:                        1904                           919
 7:                        2311                          1182
 8:                        2780                          1591
 9:                        2012                          1232
10:                        2095                          1024
11:                        3061                          1875
12:                         728                           327
13:                        2254                          1381
14:                         795                           300
15:                         619                           244
16:                        2623                          1639
17:                        2327                          1398
18:                        3204                          1890
19:                        1485                           671
20:                        2254                          1333
21:                        1964                          1061
22:                        1851                          1042
23:                        1920                          1152
24:                        1101                           546
    injuries_non_incapacitating injuries_reported_not_evident
    injuries_no_indication
                     <num>
 1:                  17122
 2:                  13554
 3:                   8393
 4:                  37427
 5:                   6511
 6:                  16086
 7:                  22132
 8:                  31370
 9:                  22197
10:                  18629
11:                  36840
12:                   5337
13:                  26311
14:                   4900
15:                   4162
16:                  29960
17:                  26786
18:                  37739
19:                  10060
20:                  24979
21:                  19722
22:                  19427
23:                  20679
24:                   9360
    injuries_no_indication
accidents[, .(injuries_fatal = sum(injuries_fatal),
              injuries_incapacitating = sum(injuries_incapacitating),
              injuries_non_incapacitating = sum(injuries_non_incapacitating),
              injuries_reported_not_evident = sum(injuries_reported_not_evident),
              injuries_no_indication = sum(injuries_no_indication)
), by = prim_contributory_cause]
                                                             prim_contributory_cause
                                                                              <char>
 1:                                                              UNABLE TO DETERMINE
 2:                                                       IMPROPER TURNING/NO SIGNAL
 3:                                                            FOLLOWING TOO CLOSELY
 4:                                              DRIVING SKILLS/KNOWLEDGE/EXPERIENCE
 5:                                                                 IMPROPER BACKING
 6:                                                    FAILING TO YIELD RIGHT-OF-WAY
 7:                                                      IMPROPER OVERTAKING/PASSING
 8:                                                  DRIVING ON WRONG SIDE/WRONG WAY
 9:                                                              IMPROPER LANE USAGE
10:                                                                   NOT APPLICABLE
11:                                           FAILING TO REDUCE SPEED TO AVOID CRASH
12:                                                     DISREGARDING TRAFFIC SIGNALS
13:                                                                          WEATHER
14:                                                           DISREGARDING STOP SIGN
15:                                                    EQUIPMENT - VEHICLE CONDITION
16: OPERATING VEHICLE IN ERRATIC, RECKLESS, CARELESS, NEGLIGENT OR AGGRESSIVE MANNER
17:                                                 DISREGARDING OTHER TRAFFIC SIGNS
18:                                                             TURNING RIGHT ON RED
19:                             VISION OBSCURED (SIGNS, TREE LIMBS, BUILDINGS, ETC.)
20:                                EVASIVE ACTION DUE TO ANIMAL, OBJECT, NONMOTORIST
21:               UNDER THE INFLUENCE OF ALCOHOL/DRUGS (USE WHEN ARREST IS EFFECTED)
22:                                               DISTRACTION - FROM OUTSIDE VEHICLE
23:                                              EXCEEDING SAFE SPEED FOR CONDITIONS
24:                                                       DISREGARDING ROAD MARKINGS
25:                                         ROAD ENGINEERING/SURFACE/MARKING DEFECTS
26:                                                     PHYSICAL CONDITION OF DRIVER
27:                                                DISTRACTION - FROM INSIDE VEHICLE
28:                                                 EXCEEDING AUTHORIZED SPEED LIMIT
29:                                                    ROAD CONSTRUCTION/MAINTENANCE
30:      DISTRACTION - OTHER ELECTRONIC DEVICE (NAVIGATION DEVICE, DVD PLAYER, ETC.)
31:                                                                           ANIMAL
32:                                  HAD BEEN DRINKING (USE WHEN ARREST IS NOT MADE)
33:                                           BICYCLE ADVANCING LEGALLY ON RED LIGHT
34:                                                CELL PHONE USE OTHER THAN TEXTING
35:                                                              RELATED TO BUS STOP
36:                                                                          TEXTING
37:                                                            OBSTRUCTED CROSSWALKS
38:                                                          DISREGARDING YIELD SIGN
39:                                        MOTORCYCLE ADVANCING LEGALLY ON RED LIGHT
40:                                                       PASSING STOPPED SCHOOL BUS
                                                             prim_contributory_cause
    injuries_fatal injuries_incapacitating injuries_non_incapacitating
             <num>                   <num>                       <num>
 1:             97                    1737                       10286
 2:              7                     260                        1994
 3:              1                     204                        1582
 4:              2                     128                         809
 5:              1                       8                          94
 6:             67                    2158                       12646
 7:              8                     113                         714
 8:              4                      97                         481
 9:              0                      73                         493
10:             10                     203                         946
11:             32                     517                        2961
12:             80                    1192                        6752
13:              1                      85                         499
14:             12                     352                        2196
15:              2                      40                         246
16:             19                     162                         696
17:              5                      88                         470
18:              0                      17                          95
19:              0                     116                         536
20:              0                      10                          52
21:              7                     118                         409
22:              1                      29                         159
23:              3                      16                          90
24:              1                      10                          50
25:              0                       3                          19
26:             15                      89                         360
27:              1                      30                         248
28:             12                      57                         151
29:              0                       5                          49
30:              0                       1                          24
31:              0                       1                          10
32:              0                      14                          33
33:              0                       6                           7
34:              0                      14                          49
35:              1                       5                          16
36:              0                       1                          18
37:              0                       3                          13
38:              0                      13                          47
39:              0                       0                           7
40:              0                       0                           0
    injuries_fatal injuries_incapacitating injuries_non_incapacitating
    injuries_reported_not_evident injuries_no_indication
                            <num>                  <num>
 1:                          6270                 128336
 2:                          1119                  29651
 3:                          1972                  45888
 4:                           468                  11087
 5:                            59                   5467
 6:                          6223                  94410
 7:                           448                  20237
 8:                           172                   2596
 9:                           324                  15684
10:                           524                  10823
11:                          1681                  24610
12:                          2900                  32277
13:                           326                   6535
14:                          1165                  14958
15:                           153                   2077
16:                           245                   4355
17:                           204                   2308
18:                            57                   1008
19:                           229                   3606
20:                            28                    545
21:                           167                   1749
22:                            83                   1619
23:                            63                    931
24:                            20                    762
25:                            10                    278
26:                           130                   1356
27:                           165                   3201
28:                            54                    862
29:                            25                    533
30:                            19                    209
31:                             2                     75
32:                            21                    293
33:                             6                     57
34:                            39                    539
35:                            10                    172
36:                            17                    165
37:                             9                    103
38:                            21                    244
39:                             0                     11
40:                             6                     66
    injuries_reported_not_evident injuries_no_indication
weather <- accidents_csv %>%
  group_by(weather_condition) %>%
  summarise(count = n()) %>%
  filter(count > 300)

weather
# A tibble: 9 × 2
  weather_condition      count
  <chr>                  <int>
1 CLEAR                 164700
2 CLOUDY/OVERCAST         7533
3 FOG/SMOKE/HAZE           360
4 FREEZING RAIN/DRIZZLE    510
5 OTHER                    627
6 RAIN                   21703
7 SLEET/HAIL               308
8 SNOW                    6871
9 UNKNOWN                 6534
ggplot(weather, aes(x = reorder(weather_condition, -count), y = count, fill = weather_condition)) +
  geom_bar(stat = "identity", alpha = 0.8) +
  labs(
    title = "Weather Conditions Recorded",
    x = "Weather Conditions",
    y = "Accidents Recorded"
  ) +
  theme_minimal() +
  theme(
    plot.title = element_text(size = 20, face = "bold"),
    axis.title = element_text(size = 16),
    axis.text.y = element_text(size = 12),
    axis.text.x = element_text(size = 12, angle = 45, hjust = 1),
    panel.grid.minor = element_blank()
  ) +
  scale_y_continuous(labels = scales::comma) + scale_fill_brewer(palette="Paired")

test <- separate(accidents_csv, crash_date, c("date", "time", "hr"), " ")
test <- test %>%
  mutate(
    crash_year = year(as.Date(date, "%m/%d/%Y"))
  )
yearly_crashes <- test %>%
  group_by(crash_year) %>%
  summarise(
    total_crashes = n())

yearly_crashes
# A tibble: 12 × 2
   crash_year total_crashes
        <int>         <int>
 1       2013             2
 2       2015          1917
 3       2016          7615
 4       2017         17655
 5       2018         27438
 6       2019         27959
 7       2020         22784
 8       2021         25689
 9       2022         25543
10       2023         25454
11       2024         26214
12       2025          1036
ggplot(yearly_crashes, aes(x = crash_year, y = total_crashes)) +
  geom_line(color = "#800", linewidth = 1.25) +
  labs(
    title = "Total Accidents Recorded",
    x = "Year",
    y = "Accidents Per Year",
    caption = "Data source: Kaggle.com"
  ) +
  theme_minimal() +
  theme(
    plot.title = element_text(size = 20, face = "bold"),
    axis.title = element_text(size = 15),
    axis.text = element_text(size = 12),
    panel.grid.minor = element_blank()
  ) +
  scale_x_continuous(breaks = c(2013:2025))

weather_severe <- accidents_csv %>%
  group_by(weather_condition) %>%
  summarise(
    injuries_severe = sum(injuries_fatal) + sum(injuries_incapacitating)
  ) %>%
  filter(injuries_severe > 10)

weather_severe
# A tibble: 8 × 2
  weather_condition     injuries_severe
  <chr>                           <dbl>
1 CLEAR                            6903
2 CLOUDY/OVERCAST                   262
3 FREEZING RAIN/DRIZZLE              22
4 OTHER                              36
5 RAIN                              844
6 SLEET/HAIL                         13
7 SNOW                              165
8 UNKNOWN                           106
ggplot(weather_severe, aes(x = reorder(weather_condition, -injuries_severe), y = injuries_severe, fill = weather_condition)) +
  geom_bar(stat = "identity", alpha = 0.8) +
  labs(
    title = "Majority of Severe Accident-Related Injuries Occur During Clear Weather",
    x = "Weather Conditions",
    y = "Injuries Recorded"
  ) +
  theme_minimal() +
  theme(
    plot.title = element_text(size = 18, face = "bold"),
    axis.title = element_text(size = 14),
    axis.text.y = element_text(size = 12),
    axis.text.x = element_text(size = 12, angle = 45, hjust = 1),
    panel.grid.minor = element_blank()
  ) +
  scale_y_continuous(labels = scales::comma) + scale_fill_brewer(palette="Set1")

lighting_severe <- accidents_csv %>%
  group_by(lighting_condition) %>%
  summarise(
    injuries_severe = sum(injuries_fatal) + sum(injuries_incapacitating)
  ) %>%
  filter(injuries_severe > 10)

lighting_severe
# A tibble: 6 × 2
  lighting_condition     injuries_severe
  <chr>                            <dbl>
1 DARKNESS                           366
2 DARKNESS, LIGHTED ROAD            2819
3 DAWN                               168
4 DAYLIGHT                          4712
5 DUSK                               238
6 UNKNOWN                             61
ggplot(lighting_severe, aes(x = reorder(lighting_condition, -injuries_severe), y = injuries_severe, fill = lighting_condition)) +
  geom_bar(stat = "identity", alpha = 0.8) +
  labs(
    title = "Majority of Severe Accident-Related Injuries Occur in Broad Daylight",
    x = "Lighting Conditions",
    y = "Injuries Recorded"
  ) +
  theme_minimal() +
  theme(
    plot.title = element_text(size = 16, face = "bold"),
    axis.title = element_text(size = 12),
    axis.text.y = element_text(size = 10),
    axis.text.x = element_text(size = 10, angle = 45, hjust = 1),
    panel.grid.minor = element_blank()
  ) +
  scale_y_continuous(labels = scales::comma) + scale_fill_brewer(palette="Set1")

cause_severe <- accidents_csv %>%
  group_by(prim_contributory_cause) %>%
  summarise(
    injuries_severe = sum(injuries_fatal) + sum(injuries_incapacitating)
  ) %>%
  filter(prim_contributory_cause != "UNABLE TO DETERMINE") %>%
  filter(prim_contributory_cause != "NOT APPLICABLE") %>%
  filter(injuries_severe > 200)

cause_severe
# A tibble: 6 × 2
  prim_contributory_cause                injuries_severe
  <chr>                                            <dbl>
1 DISREGARDING STOP SIGN                             364
2 DISREGARDING TRAFFIC SIGNALS                      1272
3 FAILING TO REDUCE SPEED TO AVOID CRASH             549
4 FAILING TO YIELD RIGHT-OF-WAY                     2225
5 FOLLOWING TOO CLOSELY                              205
6 IMPROPER TURNING/NO SIGNAL                         267
ggplot(cause_severe, aes(x = reorder(prim_contributory_cause, -injuries_severe), y = injuries_severe, fill = prim_contributory_cause)) +
  geom_bar(stat = "identity", alpha = 0.8) +
  labs(
    title = "Severe Accident-Related Injuries Are Caused By a Disregard of Traffic Rules",
    x = "Lighting Conditions",
    y = "Primary Accident Cause"
  ) +
  theme_minimal() +
  theme(
    plot.title = element_text(size = 16, face = "bold"),
    axis.title = element_text(size = 12),
    axis.text.y = element_text(size = 10),
    axis.text.x = element_text(size = 10, angle = 45, hjust = 1),
    panel.grid.minor = element_blank()
  ) +
  scale_y_continuous(labels = scales::comma) + scale_fill_brewer(palette="Set1")