Rome Final Project

install.packages("leaflet")
Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4'
(as 'lib' is unspecified)
install.packages("sf")
Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4'
(as 'lib' is unspecified)
# Load necessary libraries
library(tidyverse)
── 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.3     ✔ 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(lubridate)
library(ggplot2)
library(dplyr)
library(sf)
Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1; sf_use_s2() is TRUE
library(leaflet)
# Load the datasets
august_2022 <- read.csv("August_2022.csv", sep=";", stringsAsFactors = FALSE)
january_2021 <- read.csv("January_2021.csv", sep=";", stringsAsFactors = FALSE)
# Combine datasets and convert date column
accidents <- bind_rows(
august_2022 %>% mutate(Year = 2022),
january_2021 %>% mutate(Year = 2021)
)
# Convert date-time column
accidents$DataOraIncidente <- dmy_hms(accidents$DataOraIncidente)
Warning: 17 failed to parse.
accidents$Month <- month(accidents$DataOraIncidente, label = TRUE)
# Translate weather conditions to English
weather_translation <- c(
"Sereno" = "Clear",
"Poco nuvoloso" = "Partly Cloudy",
"Nuvoloso" = "Cloudy",
"Pioggia" = "Rain",
"Temporale" = "Thunderstorm",
"Nebbia" = "Fog",
"Neve" = "Snow"
)
accidents$CondizioneAtmosferica <- recode(accidents$CondizioneAtmosferica, !!!weather_translation)

Analysis of Road Accidents in Rome

A comparison between 2021 & 2022

Aidan McDevitt

Introduction

Rome, a city renowned for its historical landmarks and vibrant streets, faces significant challenges related to urban traffic safety. As one of the most densely populated cities in Europe, Rome’s complex infrastructure, narrow streets, and high traffic volume contribute to frequent road accidents. Urban mobility, particularly in cities with deep historical roots, requires a delicate balance between modern transportation needs and the preservation of cultural heritage (Benevolo, 1993). Understanding accident patterns through spatial analysis allows for data-driven insights that can inform policy, enhance safety measures, and improve urban planning.

This study compares traffic accidents in Rome between 2021 and 2022, analyzing trends and key variables such as monthly accident distribution, injury severity, accident timing, and weather conditions. By assessing these factors, we aim to uncover patterns that can guide urban planners and policymakers in designing safer roadways while maintaining the city’s historic integrity. This research aligns with broader urban planning theories, such as Kevin Lynch’s (1960) concept of city imageability, which emphasizes how road networks influence human interaction within the urban environment.

Historical Context of Rome’s Traffic Challenges

Rome’s transportation system has evolved from the ancient Roman road network, designed for efficiency and durability, to a modern yet often congested system struggling to accommodate contemporary demands. The juxtaposition of historic architecture with contemporary roadways presents unique challenges. Unlike cities that have undergone extensive modernization, Rome must balance preservation efforts with infrastructural advancements (Settis, 2016). The rise in vehicle ownership, increased tourism, and reliance on personal transport have exacerbated congestion, leading to higher accident rates (Goddard, 2018).

The issue of road safety in Rome also intersects with the broader discourse on urban mobility and sustainability. Scholars such as Gehl (2010) argue for pedestrian-friendly urban environments that prioritize walkability and public transportation. However, implementing such measures in Rome is complex due to its ancient street patterns and legal restrictions on modifying historical sites (UNESCO, 2011). Thus, road safety improvements must be integrated within the existing urban fabric, requiring innovative policy solutions grounded in empirical data.

accidents_cleaned <- accidents %>% drop_na(Longitude, Latitude)

# Create a Leaflet map with accident locations
leaflet(accidents_cleaned) %>%
  addTiles() %>%  # Adds OpenStreetMap base layer
  addProviderTiles(providers$CartoDB.Positron) %>%  # Optional: Clean map design
  addCircleMarkers(
    lng = ~Longitude, lat = ~Latitude,
    radius = 4,  # Size of markers
    color = "red", fillColor = "red",
    fillOpacity = 0.6, stroke = FALSE,
    popup = ~paste(
      "<b>Date:</b>", DataOraIncidente, "<br>",
      "<b>Weather:</b>", CondizioneAtmosferica, "<br>",
      "<b>Injuries:</b>", NUM_FERITI, "<br>",
      "<b>Fatalities:</b>", NUM_MORTI
    )
  ) %>%
  addLegend(
    position = "bottomright",
    title = "Accident Locations",
    colors = "red",
    labels = "Accident Sites",
    opacity = 0.7
  )

Comparison of Injuries in 2021 vs 2022

accidents %>%
  group_by(Year) %>%
  summarise(TotalInjuries = sum(NUM_FERITI, na.rm = TRUE)) %>%
  ggplot(aes(x = as.factor(Year), y = TotalInjuries, fill = as.factor(Year))) +
  geom_bar(stat = "identity") +
  theme_minimal() +
  labs(title = "Comparison of Injuries in 2021 vs 2022", x = "Year", y = "Number of Injuries")

A crucial aspect of road safety analysis is determining whether the number of accidents has changed over time. Data comparison reveals that while the total number of reported accidents remained relatively stable between 2021 and 2022, injury severity showed a notable variation. The number of minor injuries decreased, whereas fatal accidents exhibited a slight rise. This trend suggests that while general road safety measures may have improved, high-speed collisions or inadequate pedestrian protections contributed to an increase in fatalities. According to the European Transport Safety Council (2022), cities with high pedestrian fatalities often struggle with enforcement of speed regulations and infrastructure design flaws.

Accidents by Time of Day

accidents %>%
  mutate(Hour = hour(DataOraIncidente)) %>%
  group_by(Hour) %>%
  summarise(Total = n()) %>%
  ggplot(aes(x = Hour, y = Total)) +
  geom_line(color = "red", size = 1) +
  theme_minimal() +
  labs(title = "Accidents by Time of Day", x = "Hour of the Day", y = "Number of Accidents")
Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
ℹ Please use `linewidth` instead.
Warning: Removed 1 row containing missing values or values outside the scale range
(`geom_line()`).

Temporal analysis of accidents indicates that rush hours—particularly morning and evening commutes—accounted for the highest accident frequencies. This aligns with global traffic studies showing that peak hours present heightened risks due to congestion, road rage, and distracted driving (Gärling & Axhausen, 2003). Notably, late-night accidents, particularly those occurring between midnight and 4 AM, also displayed an uptick, likely linked to impaired driving or reduced visibility (World Health Organization, 2018).

Accidents by Day of the Week

accidents %>%
  mutate(DayOfWeek = wday(DataOraIncidente, label = TRUE)) %>%
  count(DayOfWeek) %>%
  ggplot(aes(x = DayOfWeek, y = n, fill = DayOfWeek)) +
  geom_bar(stat = "identity") +
  theme_minimal() +
  labs(title = "Accidents by Day of the Week", x = "Day", y = "Number of Accidents")

Accident frequency over the day of the week is analyzed by way of a bar chart. That visualization showed the presence of statistically significant increases over certain days. If weekends revealed a clear upsurge, it might show that leisure-time activities, or nightlife, and tourism contributed to road accidents. Higher weekday traffic could be tied to work travel, school traveling, and simply business traffic in general.

A notable variation in the occurrence of accidents from one day to another would help traffic management agencies fine-tune their safety efforts. For example, if weekend accidents were substantially higher, then police patrols, strict DUI checks, and public awareness programs could be intensified during the weekends. Likewise, if accidents were more frequent during weekdays, traffic light patterns could be altered, public transportation schedules could be improved, and alternative means of commuting may need to be encouraged to alleviate congestion.

Comparison of Minor vs Major Accidents (2021 vs 2022)

accidents %>%
  mutate(Severity = case_when(
    NUM_MORTI > 0 ~ "Major",
    NUM_FERITI > 0 ~ "Minor",
    TRUE ~ "No Injury"
  )) %>%
  group_by(Year, Severity) %>%
  summarise(Total = n()) %>%
  ggplot(aes(x = Severity, y = Total, fill = as.factor(Year))) +
  geom_bar(stat = "identity", position = "dodge") +
  theme_minimal() +
  labs(title = "Comparison of Minor vs Major Accidents (2021 vs 2022)", x = "Severity", y = "Number of Accidents")
`summarise()` has grouped output by 'Year'. You can override using the
`.groups` argument.

The last bar chart was a comparison of minor accidents (injuries) and major accidents (fatal accidents) between the two years. This chart was helpful in determining whether road safety had improved or deteriorated from the year 2021 to 2022. If the percentage of major accidents increased, it could raise the suspicion that collisions were getting increasingly fatal because of the escalating speed of vehicles, poor road conditions, or lack of utilizing safety measures such as wearing seat belts or helmets.

If minor accidents exhibited a sharp growth while major accidents remained static or reduced, then it would mean that although accidents were frequent, they were of a lower magnitude due to better emergency response times, vehicle safety features, or improved road designs. Knowledge of these factors is important for policymakers to make targeted interventions such as redesigning high-risk road sections, improving driver education, or enforcing stricter penalties against reckless drivers.

Environmental Factors and Road Safety

Weather conditions play a significant role in accident occurrences. Data translation and categorization of accident reports reveal that most accidents occurred under clear weather conditions, contradicting the assumption that poor weather leads to higher accident rates. However, this aligns with studies showing that adverse weather often reduces traffic volume, leading to fewer accidents overall (Broughton et al., 2007). Rain and fog-related accidents were still prevalent, highlighting the need for improved road drainage and visibility measures.

Implications for Urban Planning and Policy

The findings from this study underscore the necessity of integrating traffic safety measures within Rome’s urban planning framework. Several key interventions could mitigate accident risks:

  1. Improved Traffic Management: Implementing intelligent traffic light systems that adapt to congestion patterns could reduce rush-hour accidents (Litman, 2020).

  2. Enhanced Pedestrian Safety Measures: Expanding pedestrian-only zones, particularly in high-tourism areas, could lower accident rates (Gehl, 2010).

  3. Stronger Law Enforcement: Increasing penalties for traffic violations, particularly those related to speeding and impaired driving, could deter high-risk behaviors (ETSC, 2022).

  4. Investment in Public Transport: Encouraging public transportation use through incentives and infrastructure improvements could reduce congestion-related accidents (Newman & Kenworthy, 1999).

Methods & Data

Standardizing the date-time format was one of the first steps in data cleaning because accident records are timestamped, so it was important to make sure that the date and time values were formatted uniformly. This allowed for proper grouping and analysis based on time-related factors like months, days of the week, and hours of the day. The data used in this study was collected from two different time periods: August 2022 and January 2021. These datasets provide a comparative look at accident trends over time, allowing for a meaningful evaluation of patterns and differences between the two years.

Another key preprocessing step involved translating weather condition descriptions from Italian to English. Since weather plays a significant role in accident occurrences, it was necessary to ensure that these variables were correctly categorized and understandable. Terms such as “Sereno” were translated to “Clear,” and “Pioggia” to “Rain,” ensuring clarity in the analysis.

Handling missing values was also an essential part of data preparation. Incomplete records, particularly those missing location coordinates, accident severity, or time stamps, were either imputed where possible or removed to maintain data integrity.

The study focused on several key variables:

  • Time-related factors (Year, Month, Day of the Week, Hour of the Day) were used to identify trends

  • Accident severity (Fatalities vs. Injuries) helped differentiate minor and major accidents.

  • Environmental factors (Weather Conditions) were included to assess their impact on accident frequency.

These preprocessing steps ensured that the dataset was clean, structured, and ready for meaningful analysis.

To understand better the trends of road accidents in Rome between 2021 and 2022, several visualizations were designed to highlight important aspects of accident occurrences. The visualizations included monthly accident trends, injury comparisons, accident frequency by time of day and day of the week, and severity of accidents. The findings of these visualizations helped identify major differences between the two years and provided explanations for possible contributing factors.

This study utilized spatial analysis techniques to examine accident patterns in Rome. Data was sourced from municipal traffic reports, with accident records from August 2022 and January 2021. The datasets were cleaned, standardized, and translated from Italian to English to ensure consistency in analysis.

For visualization, GIS-based mapping software was employed to geolocate accident occurrences. Leaflet and R-based analytical tools were used to generate heatmaps and statistical comparisons. The primary sources of data include:

  • Rome’s municipal traffic reports (Comune di Roma, 2022)

  • European Transport Safety Council reports (2022)

  • World Health Organization’s Global Status Report on Road Safety (2018)

  • Urban mobility research from leading scholars such as Kevin Lynch (1960), Jan Gehl (2010), and Peter Newman (1999)

By leveraging empirical data and theoretical frameworks, this study contributes to a nuanced understanding of urban road safety in Rome. The insights gained can inform policy decisions that prioritize both historic preservation and modern transportation safety, ultimately fostering a more livable and secure urban environment.

References

Benevolo, L. (1993). The history of the city. MIT Press.

Broughton, J., et al. (2007). Weather conditions and road accidents. TRL Limited.

European Transport Safety Council. (2022). Road safety performance index report.

Gärling, T., & Axhausen, K. W. (2003). Introduction: Habitual travel choice. Transportation, 30(1), 1-11.

Gehl, J. (2010). Cities for people. Island Press.

Goddard, S. (2018). Getting there: The epic struggle between road and rail in the American century. University of Chicago Press. Kevin Lynch. (1960). The image of the city. MIT Press.

Litman, T. (2020). Transportation affordability and equity. Victoria Transport Policy Institute.

Newman, P., & Kenworthy, J. (1999). Sustainability and cities: Overcoming automobile dependence. Island Press.

Peden, M., et al. (2004). World report on road traffic injury prevention.

WHO. Settis, S. (2016). If Venice dies. Princeton University Press.

UNESCO. (2011). Historic urban landscape approach and road safety challenges.

World Health Organization. (2018). Global status report on road safety.