# Load libraries
library(tidyverse)
library(dplyr)
library(ggplot2)
library(knitr)
Does fleeing from police bring about more shootings versus not fleeing?
This analysis examines the relationship between fleeing behavior and fatal police shootings in the United States. The dataset used in this study is sourced from OpenIntro.org Data Sets and contains comprehensive information about fatal police shootings from 2015 onwards. Understanding whether fleeing behavior is associated with the number of fatal shootings is important for understanding police-civilian interactions and could inform policy discussions about de-escalation tactics and pursuit protocols.
For this analysis, we will focus on the flee variable from the dataset, which indicates whether the individual was fleeing at the time of the shooting and, if so, how they were fleeing (by car, on foot, or other means). We will compare the number of fatal shootings that occurred when individuals were fleeing versus when they were not fleeing. The dataset contains information about 6,421 fatal police shooting incidents across the United States. By analyzing this variable, we can determine which scenario (fleeing vs. not fleeing) is associated with more fatal shootings.
To answer our research question, we will perform several
straightforward analytical steps. First, we will load the dataset and
explore its structure to understand the data we’re working with. Then,
we will clean the data by examining the flee variable and categorizing
cases into “Fleeing” (which includes fleeing by car, foot, or other
means) versus “Not Fleeing.” We will use basic mathematical functions
like sum(), mean(), and table()
to count and calculate the number and percentage of shootings in each
category. Finally, we will create a bar chart visualization to clearly
display the comparison between fleeing and not fleeing cases.
# Load the dataset
setwd("C:/Users/user/Downloads")
shootings <- read.csv("fatal_police_shootings.csv")
# Display the first few rows to see what the data looks like
head(shootings)
## date manner_of_death armed age gender race city state
## 1 2015-01-02 shot gun 53 M A Shelton WA
## 2 2015-01-02 shot gun 47 M W Aloha OR
## 3 2015-01-03 shot and Tasered unarmed 23 M H Wichita KS
## 4 2015-01-04 shot toy weapon 32 M W San Francisco CA
## 5 2015-01-04 shot nail gun 39 M H Evans CO
## 6 2015-01-04 shot gun 18 M W Guthrie OK
## signs_of_mental_illness threat_level flee body_camera
## 1 True attack Not fleeing False
## 2 False attack Not fleeing False
## 3 False other Not fleeing False
## 4 True attack Not fleeing False
## 5 False attack Not fleeing False
## 6 False attack Not fleeing False
# Display the structure of the dataset
str(shootings)
## 'data.frame': 6421 obs. of 12 variables:
## $ date : chr "2015-01-02" "2015-01-02" "2015-01-03" "2015-01-04" ...
## $ manner_of_death : chr "shot" "shot" "shot and Tasered" "shot" ...
## $ armed : chr "gun" "gun" "unarmed" "toy weapon" ...
## $ age : int 53 47 23 32 39 18 22 35 34 47 ...
## $ gender : chr "M" "M" "M" "M" ...
## $ race : chr "A" "W" "H" "W" ...
## $ city : chr "Shelton" "Aloha" "Wichita" "San Francisco" ...
## $ state : chr "WA" "OR" "KS" "CA" ...
## $ signs_of_mental_illness: chr "True" "False" "False" "True" ...
## $ threat_level : chr "attack" "attack" "other" "attack" ...
## $ flee : chr "Not fleeing" "Not fleeing" "Not fleeing" "Not fleeing" ...
## $ body_camera : chr "False" "False" "False" "False" ...
# Check the total number of cases
cat("Total number of shooting incidents:", nrow(shootings), "\n")
## Total number of shooting incidents: 6421
cat("Total number of variables in dataset:", ncol(shootings), "\n")
## Total number of variables in dataset: 12
# Examine the flee variable to see what values it contains
cat("Unique values in the flee variable:\n")
## Unique values in the flee variable:
print(unique(shootings$flee))
## [1] "Not fleeing" "Car" "Foot" "Other" ""
# Get a summary of the flee variable
cat("\nSummary of flee variable:\n")
##
## Summary of flee variable:
summary(shootings$flee)
## Length Class Mode
## 6421 character character
# Count how many cases we have for each flee category
cat("\nFrequency table for flee variable:\n")
##
## Frequency table for flee variable:
table(shootings$flee)
##
## Car Foot Not fleeing Other
## 434 1035 832 3883 237
# Create a binary fleeing variable: "Fleeing" vs "Not Fleeing"
# "Not fleeing" stays as "Not Fleeing"
# Everything else (Car, Foot, Other) becomes "Fleeing"
shootings_clean <- shootings %>%
mutate(flee_status = ifelse(flee == "Not fleeing", "Not Fleeing", "Fleeing"))
# Count total shootings for each category
fleeing_counts <- table(shootings_clean$flee_status)
cat("Total shootings by fleeing status:\n")
## Total shootings by fleeing status:
print(fleeing_counts)
##
## Fleeing Not Fleeing
## 2538 3883
# Calculate the sum for each category
fleeing_sum <- sum(shootings_clean$flee_status == "Fleeing")
not_fleeing_sum <- sum(shootings_clean$flee_status == "Not Fleeing")
cat("\n--- Summary Statistics ---\n")
##
## --- Summary Statistics ---
cat("Total shootings where person was FLEEING:", fleeing_sum, "\n")
## Total shootings where person was FLEEING: 2538
cat("Total shootings where person was NOT FLEEING:", not_fleeing_sum, "\n")
## Total shootings where person was NOT FLEEING: 3883
# Calculate percentages
total_cases <- nrow(shootings_clean)
fleeing_percentage <- (fleeing_sum / total_cases) * 100
not_fleeing_percentage <- (not_fleeing_sum / total_cases) * 100
cat("\nPercentage of shootings where person was FLEEING:", round(fleeing_percentage, 2), "%\n")
##
## Percentage of shootings where person was FLEEING: 39.53 %
cat("Percentage of shootings where person was NOT FLEEING:", round(not_fleeing_percentage, 2), "%\n")
## Percentage of shootings where person was NOT FLEEING: 60.47 %
# Calculate the difference
difference <- abs(fleeing_sum - not_fleeing_sum)
cat("\nDifference in number of shootings:", difference, "\n")
##
## Difference in number of shootings: 1345
# Determine which category has more shootings
if(fleeing_sum > not_fleeing_sum) {
cat("Result: MORE shootings occurred when people were FLEEING\n")
} else {
cat("Result: MORE shootings occurred when people were NOT FLEEING\n")
}
## Result: MORE shootings occurred when people were NOT FLEEING
# Calculate the mean for verification
# We'll create a numeric version where Fleeing=1 and Not Fleeing=0
shootings_clean <- shootings_clean %>%
mutate(flee_numeric = ifelse(flee_status == "Fleeing", 1, 0))
average_fleeing <- mean(shootings_clean$flee_numeric)
cat("\nAverage fleeing rate:", round(average_fleeing, 3), "\n")
##
## Average fleeing rate: 0.395
cat("(This represents the proportion of cases involving fleeing)\n")
## (This represents the proportion of cases involving fleeing)
# Create summary data for the bar chart
fleeing_summary <- shootings_clean %>%
group_by(flee_status) %>%
summarise(count = n()) %>%
arrange(desc(count))
# Create a bar chart comparing fleeing vs not fleeing
ggplot(fleeing_summary, aes(x = flee_status, y = count, fill = flee_status)) +
geom_bar(stat = "identity") +
labs(title = "Fatal Police Shootings: Fleeing vs Not Fleeing",
subtitle = "Comparison of Shooting Incidents by Fleeing Status",
x = "Fleeing Status",
y = "Number of Shooting Incidents",
fill = "Status") +
theme_minimal() +
theme(plot.title = element_text(hjust = 0.5, face = "bold", size = 14),
plot.subtitle = element_text(hjust = 0.5, size = 11),
legend.position = "none",
axis.text = element_text(size = 12),
axis.title = element_text(size = 12, face = "bold")) +
scale_fill_manual(values = c("Fleeing" = "red", "Not Fleeing" = "blue")) +
geom_text(aes(label = count), vjust = -0.5, size = 6, fontface = "bold")
The analysis reveals clear and important findings about the relationship between fleeing behavior and fatal police shootings. Out of 6,421 total shooting incidents in our dataset, we found that a majority of fatal police shootings occurred when individuals were NOT fleeing. Specifically, individuals who were not fleeing account for a higher number of fatal shootings compared to those who were fleeing.The data shows that 3,883 incidents involved individuals who were not fleeing, while 2,538 incidents involved individuals who were fleeing by car, foot, or other means. This translates to 60.47% of fatal shootings occurring when the person was not fleeing, compared to 39.53% when the person was fleeing. The difference between these two categories is 1,345 shootings, with not fleeing cases outnumbering fleeing cases by a ratio of approximately 1.5 to 1.
These findings have important implications for understanding police-civilian interactions and fatal shooting incidents. The results directly answer our research question: fleeing from police does NOT bring about more shootings compared to not fleeing. In fact, the opposite is true - more fatal shootings occur when individuals are not fleeing from police, with about 60% of fatal shootings involving individuals who were not fleeing versus about 40% who were fleeing. This finding may seem counterintuitive at first, but it makes sense when we consider the circumstances of police shootings. Many fatal police shootings occur during confrontations where individuals are standing their ground, posing an immediate threat, or engaging in aggressive behavior toward officers or others. In these “not fleeing” scenarios, officers may perceive a more direct and immediate threat, leading to the use of lethal force. Future research could explore the relationship between fleeing behavior and whether individuals were armed. This could reveal whether fleeing while armed creates different outcomes than fleeing while unarmed. We could also investigate whether different regions, states, or urban vs. rural areas show different patterns in the relationship between fleeing and fatal shootings, which could reveal policy or training differences.
The Washington Post. (2015-present). Fatal Force: Police Shootings Database. GitHub repository. Retrieved from https://github.com/washingtonpost/data-police-shootings
OpenIntro.org. (n.d.). Fatal Police Shootings Dataset. OpenIntro Data Sets. Retrieved from https://www.openintro.org/data/index.php?data=fatal_police_shootings