For this project, I decided to use the US mass shootings dataset provided by Mother Jones and the Foundation for National Progress. This was a really interesting and informative dataset, and I chose it because I am very passionate about gun control in the United States. Most of the data is made up of categorical variables, such as the venues where the mass shootings took place, the race and gender of the mass shooters, whether or not there were prior signs of mental illness seen in the mass shooters, and more. There were also numerical variables such as the number of injuries, number of fatalities, and total number of victims for each case. Finally, this dataset included descriptive variables, such as the types of weapons used and summaries of each case.
Because of the many different areas I could explore in this dataset (simply because of the amount of variables it has), I knew I would have to narrow down what I wanted to explore more thoroughly for the final visualizations, and I would do this by performing statistical analysis and creating simple plots with different variables.
library(ggplot2)
library(rio)
## Warning: package 'rio' was built under R version 4.0.5
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.0.4
##
## 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(RColorBrewer)
library(viridis)
## Warning: package 'viridis' was built under R version 4.0.5
## Loading required package: viridisLite
## Warning: package 'viridisLite' was built under R version 4.0.5
library(lubridate)
## Warning: package 'lubridate' was built under R version 4.0.4
##
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
# Here I called in the csv file for the data set
setwd("C:/Users/12403/Documents/DATA 110/R_Datasets")
mass_shootings <- import("mass_shootings.csv")
head(mass_shootings)
## Case Location Date Year
## 1 Texas First Baptist Church massacre Sutherland Springs, TX 11/5/2017 2017
## 2 Walmart shooting in suburban Denver Thornton, CO 11/1/2017 2017
## 3 Edgewood businees park shooting Edgewood, MD 10/18/2017 2017
## 4 Las Vegas Strip massacre Las Vegas, NV 10/1/2017 2017
## 5 San Francisco UPS shooting San Francisco, CA 6/14/2017 2017
## 6 Pennsylvania supermarket shooting Tunkhannock, PA 6/7/2017 2017
## Summary
## 1 Devin Patrick Kelley, a 26-year-old ex-US Air Force airman, opened fire at the First Baptist Church in Sutherland Springs during Sunday morning services, killing at least 26 people and wounding and injuring 20 others. He left the church and fled in his vehicle after engaging in a gunfight with a local citizen; he soon crashed his vehicle and died from a self-inflicted gunshot wound.
## 2 Scott Allen Ostrem, 47, walked into a Walmart in a suburb north of Denver and fatally shot two men and a woman, then left the store and drove away. After an all-night manhunt, Ostrem, who had financial problems but no serious criminal history, was captured by police after being spotted near his apartment in Denver.
## 3 Radee Labeeb Prince, 37, fatally shot three people and wounded two others around 9am at Advance Granite Solutions, a home remodeling business where he worked near Baltimore. Hours later he shot and wounded a sixth person at a car dealership in Wilmington, Delaware. He was apprehended that evening following a manhunt by authorities.
## 4 Stephen Craig Paddock, 64, rained a barrage of rapid gunfire down on thousands of concertgoers on the Las Vegas Strip late on a Sunday night, firing from a corner suite on the 32nd floor of the Mandalay Bay Resort and Casino. Soon thereafter, he was found by law enforcement inside the hotel room, deceased from a self-inflicted gunshot wound.
## 5 Jimmy Lam, 38, fatally shot three coworkers and wounded two others inside a UPS facility in San Francisco. Lam killed himself as law enforcement officers responded to the scene.
## 6 Randy Stair, a 24-year-old worker at Weis grocery fatally shot three of his fellow employees. He reportedly fired 59 rounds with a pair of shotguns before turning the gun on himself as another co-worker fled the scene for help and law enforcement responded.
## Fatalities Injured Total victims Venue
## 1 26 20 46 Religious
## 2 3 0 3 Other
## 3 3 3 6 Workplace
## 4 58 489 547 Other
## 5 3 2 5 Workplace
## 6 3 0 3 Workplace
## Prior signs of mental health issues
## 1 Yes
## 2 Unclear
## 3 Unclear
## 4 TBD
## 5 Yes
## 6 Unclear
## Mental health - details
## 1 Kelley had a history of domestic violence, including a court martial and conviction stemming from assaulting his wife and child; he also had a history of cruelty to animals and of stalking and harassing ex-girlfriends, including an underage girl. He reportedly briefly escaped from a mental health facility in 2012.
## 2
## 3
## 4 Perpetrator's history unclear. In 1969 Paddock's father was classified by the FBI as a dangerous psychopath with suicidal tendencies; psychopathy can be heritable (see Mother Jones sourcing).
## 5 Lam had a history of domestic, work conflict
## 6
## Weapons obtained legally
## 1 Kelley passed federal criminal background checks; the US Air Force failed to provide information on his criminal history to the FBI
## 2 TBD
## 3 No
## 4 Yes
## 5 No
## 6 TBD
## Where obtained
## 1 Purchased in April 2016 from an Academy Sports & Outdoors store in San Antonio
## 2
## 3 Unclear
## 4 Two gun shops in Nevada
## 5 Unclear; the firearm was stolen in Utah. A second handgun Lam had (also stolen) was unused in the attack.
## 6
## Type of weapons
## 1 semiautomatic rifle
## 2
## 3 handgun
## 4 23 firearms, mostly rifles; including scopes, and two modified for ""fully automatic"" firing; two were mounted on tripods
## 5 two handguns
## 6 shotguns
## Weapon details
## 1 Ruger AR-556; Kelley also possessed semiautomatic handguns
## 2
## 3 .380-caliber; make unclear
## 4 AR-15-style and AK-47-style rifles and ""a large cache of ammunition""; four Daniel Defense DDM4 rifles, three FN-15s and other rifles made by Sig Sauer.
## 5 MAC-10-style â\200œassault pistolâ\200\235; 30-round magazine. An additional box of ammunition.
## 6
## Race Gender
## 1 White Male
## 2 White Male
## 3 Black Male
## 4 White Male
## 5 Asian Male
## 6 White Male
## Sources
## 1 https://www.washingtonpost.com/news/morning-mix/wp/2017/11/06/who-is-devin-patrick-kelley-gunman-who-officials-say-killed-churchgoers-in-sutherland-springs/; https://www.washingtonpost.com/news/post-nation/wp/2017/11/06/investigators-hunt-for-motive-in-texas-church-shooting-as-the-grieving-spans-generations/; https://www.washingtonpost.com/news/morning-mix/wp/2017/11/06/an-unlikely-hero-describes-gun-battle-and-95-mph-chase-with-texas-shooting-suspect/; http://www.cnn.com/2017/11/06/us/texas-church-shooting/index.html; https://www.usnews.com/news/top-news/articles/2017-11-06/church-shooter-killed-himself-after-vehicle-chase-sheriff-tells-cbs
## 2 https://www.nytimes.com/2017/11/01/us/thornton-colorado-walmart-shooting.html; http://www.cnn.com/2017/11/01/us/colorado-walmart-shooting/index.html; http://www.thedenverchannel.com/news/crime/colorado-walmart-shooting-suspect-scott-ostrem-had-run-ins-with-police-financial-troubles
## 3 http://www.baltimoresun.com/news/maryland/harford/aegis/ph-ag-edgewood-shooting-20171018-story.html; http://www.cnn.com/2017/10/18/us/maryland-harford-county-shooting/index.html
## 4 https://www.nytimes.com/2017/10/02/us/stephen-paddock-vegas-shooter.html; https://www.wsj.com/articles/las-vegas-suspect-likely-used-automatic-rifle-in-massacre-1506966716; https://www.usatoday.com/story/news/nation/2017/10/02/las-vegas-shooting/722191001/; https://www.usatoday.com/story/news/nation/2017/10/02/las-vegas-shooting/722191001/; http://www.latimes.com/nation/la-las-vegas-shooting-live-updates-paddock-had-19-rifles-in-room-1506985512-htmlstory.html; https://www.nytimes.com/2017/10/02/us/stephen-paddock-vegas-shooter.html; https://www.usatoday.com/story/news/nation/2017/10/06/here-all-victims-las-vegas-shooting/733236001/
## 5 http://www.nbcbayarea.com/news/local/Active-Shooter-San-Francisco-Police-428441423.html; https://apnews.com/2c1690393510447995018b0f9467b44c?utm_campaign=SocialFlow&utm_source=Twitter&utm_medium=AP; http://www.sfchronicle.com/bayarea/article/Police-swarm-UPS-building-in-SF-on-report-of-11219519.php; https://www.pressroom.ups.com/pressroom/ContentDetailsViewer.page?ConceptType=PressReleases&id=1497461182413-836; http://www.foxnews.com/us/2017/06/15/san-francisco-ups-facility-shooting-gunman-identified-as-police-seek-motive.html; http://www.sfgate.com/crime/article/UPS-shooter-in-San-Francisco-used-stolen-gun-with-11243414.php
## 6 http://www.pressconnects.com/story/news/local/pennsylvania/2017/06/08/dead-murder-suicide-pa-weis/102621742/; https://www.washingtonpost.com/news/morning-mix/wp/2017/06/09/killer-in-supermarket-shooting-posted-chilling-videos-online-lauding-columbine-massacre/?utm_term=.4cf2327eb879; https://www.cbsnews.com/news/weiss-supermarket-shooting-spree-randy-stair-spared-coworker/
## Mental Health Sources
## 1 http://www.expressnews.com/news/local/article/Suspected-gunman-Devin-Patrick-Kelley-lived-near-12334186.php; http://www.denverpost.com/2017/11/06/texas-shooting-devin-patrick-kelley-colorado-arrest/; https://www.nbcnews.com/storyline/texas-church-shooting/who-devin-kelley-alleged-texas-church-shooter-n817806; https://www.click2houston.com/news/sutherland-springs-church-shooter-escaped-mental-health-facility-months-after-attack-on-wife-child
## 2
## 3
## 4 https://www.nytimes.com/2017/10/13/us/stephen-paddock-father-vegas.html; http://www.motherjones.com/crime-justice/2017/10/the-las-vegas-shooter-didnt-just-snap-they-never-do/
## 5 http://www.ktvu.com/news/ktvu-local-news/261771610-story; https://twitter.com/LauraGarciaCann/status/875072768471117824; http://heavy.com/news/2017/06/jimmy-lam-ups-san-francisco-shooting-suspect/; http://heavy.com/news/2017/06/jimmy-lam-ups-san-francisco-shooting-suspect/
## 6
## latitude longitude Type
## 1 32.78011 -96.80001 Mass
## 2 43.06057 -88.10648 Mass
## 3 NA NA Mass
## 4 32.69340 -97.47067 Mass
## 5 NA NA Mass
## 6 35.04716 -85.31182 Mass
# I used the str command to see a quick summary of the data
str(mass_shootings)
## 'data.frame': 94 obs. of 22 variables:
## $ Case : chr "Texas First Baptist Church massacre" "Walmart shooting in suburban Denver" "Edgewood businees park shooting" "Las Vegas Strip massacre" ...
## $ Location : chr "Sutherland Springs, TX" "Thornton, CO" "Edgewood, MD" "Las Vegas, NV" ...
## $ Date : chr "11/5/2017" "11/1/2017" "10/18/2017" "10/1/2017" ...
## $ Year : int 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 ...
## $ Summary : chr "Devin Patrick Kelley, a 26-year-old ex-US Air Force airman, opened fire at the First Baptist Church in Sutherla"| __truncated__ "Scott Allen Ostrem, 47, walked into a Walmart in a suburb north of Denver and fatally shot two men and a woman,"| __truncated__ "Radee Labeeb Prince, 37, fatally shot three people and wounded two others around 9am at Advance Granite Solutio"| __truncated__ "Stephen Craig Paddock, 64, rained a barrage of rapid gunfire down on thousands of concertgoers on the Las Vegas"| __truncated__ ...
## $ Fatalities : int 26 3 3 58 3 3 5 3 3 5 ...
## $ Injured : int 20 0 3 489 2 0 0 0 0 6 ...
## $ Total victims : int 46 3 6 547 5 3 5 3 3 11 ...
## $ Venue : chr "Religious" "Other" "Workplace" "Other" ...
## $ Prior signs of mental health issues: chr "Yes" "Unclear" "Unclear" "TBD" ...
## $ Mental health - details : chr "Kelley had a history of domestic violence, including a court martial and conviction stemming from assaulting hi"| __truncated__ "" "" "Perpetrator's history unclear. In 1969 Paddock's father was classified by the FBI as a dangerous psychopath wit"| __truncated__ ...
## $ Weapons obtained legally : chr "Kelley passed federal criminal background checks; the US Air Force failed to provide information on his crimina"| __truncated__ "TBD" "No" "Yes" ...
## $ Where obtained : chr "Purchased in April 2016 from an Academy Sports & Outdoors store in San Antonio" "" "Unclear" "Two gun shops in Nevada" ...
## $ Type of weapons : chr "semiautomatic rifle" "" "handgun" "23 firearms, mostly rifles; including scopes, and two modified for \"\"fully automatic\"\" firing; two were mounted on tripods" ...
## $ Weapon details : chr "Ruger AR-556; Kelley also possessed semiautomatic handguns" "" ".380-caliber; make unclear" "AR-15-style and AK-47-style rifles and \"\"a large cache of ammunition\"\"; four Daniel Defense DDM4 rifles, th"| __truncated__ ...
## $ Race : chr "White" "White" "Black" "White" ...
## $ Gender : chr "Male" "Male" "Male" "Male" ...
## $ Sources : chr "https://www.washingtonpost.com/news/morning-mix/wp/2017/11/06/who-is-devin-patrick-kelley-gunman-who-officials-"| __truncated__ "https://www.nytimes.com/2017/11/01/us/thornton-colorado-walmart-shooting.html; http://www.cnn.com/2017/11/01/us"| __truncated__ "http://www.baltimoresun.com/news/maryland/harford/aegis/ph-ag-edgewood-shooting-20171018-story.html; http://www"| __truncated__ "https://www.nytimes.com/2017/10/02/us/stephen-paddock-vegas-shooter.html; https://www.wsj.com/articles/las-vega"| __truncated__ ...
## $ Mental Health Sources : chr "http://www.expressnews.com/news/local/article/Suspected-gunman-Devin-Patrick-Kelley-lived-near-12334186.php; ht"| __truncated__ "" "" "https://www.nytimes.com/2017/10/13/us/stephen-paddock-father-vegas.html; http://www.motherjones.com/crime-justi"| __truncated__ ...
## $ latitude : num 32.8 43.1 NA 32.7 NA ...
## $ longitude : num -96.8 -88.1 NA -97.5 NA ...
## $ Type : chr "Mass" "Mass" "Mass" "Mass" ...
mass_shootings$`Total victims` <- as.numeric(as.character(mass_shootings$`Total victims`))
mass_shootings$Fatalities <- as.numeric(as.character(mass_shootings$Fatalities))
mass_shootings$Injured <- as.numeric(as.character(mass_shootings$Injured))
str(mass_shootings)
## 'data.frame': 94 obs. of 22 variables:
## $ Case : chr "Texas First Baptist Church massacre" "Walmart shooting in suburban Denver" "Edgewood businees park shooting" "Las Vegas Strip massacre" ...
## $ Location : chr "Sutherland Springs, TX" "Thornton, CO" "Edgewood, MD" "Las Vegas, NV" ...
## $ Date : chr "11/5/2017" "11/1/2017" "10/18/2017" "10/1/2017" ...
## $ Year : int 2017 2017 2017 2017 2017 2017 2017 2017 2017 2017 ...
## $ Summary : chr "Devin Patrick Kelley, a 26-year-old ex-US Air Force airman, opened fire at the First Baptist Church in Sutherla"| __truncated__ "Scott Allen Ostrem, 47, walked into a Walmart in a suburb north of Denver and fatally shot two men and a woman,"| __truncated__ "Radee Labeeb Prince, 37, fatally shot three people and wounded two others around 9am at Advance Granite Solutio"| __truncated__ "Stephen Craig Paddock, 64, rained a barrage of rapid gunfire down on thousands of concertgoers on the Las Vegas"| __truncated__ ...
## $ Fatalities : num 26 3 3 58 3 3 5 3 3 5 ...
## $ Injured : num 20 0 3 489 2 0 0 0 0 6 ...
## $ Total victims : num 46 3 6 547 5 3 5 3 3 11 ...
## $ Venue : chr "Religious" "Other" "Workplace" "Other" ...
## $ Prior signs of mental health issues: chr "Yes" "Unclear" "Unclear" "TBD" ...
## $ Mental health - details : chr "Kelley had a history of domestic violence, including a court martial and conviction stemming from assaulting hi"| __truncated__ "" "" "Perpetrator's history unclear. In 1969 Paddock's father was classified by the FBI as a dangerous psychopath wit"| __truncated__ ...
## $ Weapons obtained legally : chr "Kelley passed federal criminal background checks; the US Air Force failed to provide information on his crimina"| __truncated__ "TBD" "No" "Yes" ...
## $ Where obtained : chr "Purchased in April 2016 from an Academy Sports & Outdoors store in San Antonio" "" "Unclear" "Two gun shops in Nevada" ...
## $ Type of weapons : chr "semiautomatic rifle" "" "handgun" "23 firearms, mostly rifles; including scopes, and two modified for \"\"fully automatic\"\" firing; two were mounted on tripods" ...
## $ Weapon details : chr "Ruger AR-556; Kelley also possessed semiautomatic handguns" "" ".380-caliber; make unclear" "AR-15-style and AK-47-style rifles and \"\"a large cache of ammunition\"\"; four Daniel Defense DDM4 rifles, th"| __truncated__ ...
## $ Race : chr "White" "White" "Black" "White" ...
## $ Gender : chr "Male" "Male" "Male" "Male" ...
## $ Sources : chr "https://www.washingtonpost.com/news/morning-mix/wp/2017/11/06/who-is-devin-patrick-kelley-gunman-who-officials-"| __truncated__ "https://www.nytimes.com/2017/11/01/us/thornton-colorado-walmart-shooting.html; http://www.cnn.com/2017/11/01/us"| __truncated__ "http://www.baltimoresun.com/news/maryland/harford/aegis/ph-ag-edgewood-shooting-20171018-story.html; http://www"| __truncated__ "https://www.nytimes.com/2017/10/02/us/stephen-paddock-vegas-shooter.html; https://www.wsj.com/articles/las-vega"| __truncated__ ...
## $ Mental Health Sources : chr "http://www.expressnews.com/news/local/article/Suspected-gunman-Devin-Patrick-Kelley-lived-near-12334186.php; ht"| __truncated__ "" "" "https://www.nytimes.com/2017/10/13/us/stephen-paddock-father-vegas.html; http://www.motherjones.com/crime-justi"| __truncated__ ...
## $ latitude : num 32.8 43.1 NA 32.7 NA ...
## $ longitude : num -96.8 -88.1 NA -97.5 NA ...
## $ Type : chr "Mass" "Mass" "Mass" "Mass" ...
# Used the dplyr select command to choose the specific variables I wanted to work with
ms_clean <- mass_shootings %>%
select(Case, Location, Date, Year, Fatalities, Injured, `Total victims`, Venue, `Prior signs of mental health issues`, `Weapons obtained legally`, `Weapon details`, Race, Gender)
head(ms_clean)
## Case Location Date Year
## 1 Texas First Baptist Church massacre Sutherland Springs, TX 11/5/2017 2017
## 2 Walmart shooting in suburban Denver Thornton, CO 11/1/2017 2017
## 3 Edgewood businees park shooting Edgewood, MD 10/18/2017 2017
## 4 Las Vegas Strip massacre Las Vegas, NV 10/1/2017 2017
## 5 San Francisco UPS shooting San Francisco, CA 6/14/2017 2017
## 6 Pennsylvania supermarket shooting Tunkhannock, PA 6/7/2017 2017
## Fatalities Injured Total victims Venue
## 1 26 20 46 Religious
## 2 3 0 3 Other
## 3 3 3 6 Workplace
## 4 58 489 547 Other
## 5 3 2 5 Workplace
## 6 3 0 3 Workplace
## Prior signs of mental health issues
## 1 Yes
## 2 Unclear
## 3 Unclear
## 4 TBD
## 5 Yes
## 6 Unclear
## Weapons obtained legally
## 1 Kelley passed federal criminal background checks; the US Air Force failed to provide information on his criminal history to the FBI
## 2 TBD
## 3 No
## 4 Yes
## 5 No
## 6 TBD
## Weapon details
## 1 Ruger AR-556; Kelley also possessed semiautomatic handguns
## 2
## 3 .380-caliber; make unclear
## 4 AR-15-style and AK-47-style rifles and ""a large cache of ammunition""; four Daniel Defense DDM4 rifles, three FN-15s and other rifles made by Sig Sauer.
## 5 MAC-10-style â\200œassault pistolâ\200\235; 30-round magazine. An additional box of ammunition.
## 6
## Race Gender
## 1 White Male
## 2 White Male
## 3 Black Male
## 4 White Male
## 5 Asian Male
## 6 White Male
For my statistical analysis, I wanted to see how mass shootings have increased (or decreased) over time, as well as the average, range, and any outliers for each specific year. To do so, I decided that creating boxplots for each year would be the best way to see this information.
The first thing I did was narrow down the data to both the year 2000-2017 as well as the total number of victims in each mass shooting incident using dplyr commands.
stat_analysis <- ms_clean %>%
filter(Year %in% c('2017', '2016', '2015', '2014', '2013', '2012', '2011', '2010', '2009', '2008', '2007', '2006', '2005', '2004', '2003', '2001', '2000')) %>%
select(Year, 'Total victims') %>%
group_by(Year) %>%
arrange(Year)
as.data.frame(stat_analysis)
## Year Total victims
## 1 2000 7
## 2 2001 9
## 3 2003 15
## 4 2004 12
## 5 2005 15
## 6 2005 11
## 7 2006 11
## 8 2006 9
## 9 2006 8
## 10 2007 13
## 11 2007 7
## 12 2007 55
## 13 2007 10
## 14 2008 7
## 15 2008 26
## 16 2008 8
## 17 2009 5
## 18 2009 43
## 19 2009 18
## 20 2009 11
## 21 2010 11
## 22 2011 9
## 23 2011 12
## 24 2011 19
## 25 2012 29
## 26 2012 8
## 27 2012 10
## 28 2012 82
## 29 2012 7
## 30 2012 10
## 31 2012 5
## 32 2013 20
## 33 2013 7
## 34 2013 9
## 35 2013 5
## 36 2013 7
## 37 2014 6
## 38 2014 19
## 39 2014 15
## 40 2014 6
## 41 2015 35
## 42 2015 12
## 43 2015 3
## 44 2015 18
## 45 2015 7
## 46 2015 10
## 47 2015 4
## 48 2016 5
## 49 2016 6
## 50 2016 16
## 51 2016 102
## 52 2016 17
## 53 2016 8
## 54 2017 46
## 55 2017 3
## 56 2017 6
## 57 2017 547
## 58 2017 5
## 59 2017 3
## 60 2017 5
## 61 2017 3
## 62 2017 3
## 63 2017 11
head(stat_analysis)
## # A tibble: 6 x 2
## # Groups: Year [5]
## Year `Total victims`
## <int> <dbl>
## 1 2000 7
## 2 2001 9
## 3 2003 15
## 4 2004 12
## 5 2005 15
## 6 2005 11
analysis1 <- ggplot(stat_analysis, aes(x=Year, y=`Total victims`, group=Year)) +
geom_boxplot() + # Created a boxplot using the ggplot package
scale_fill_viridis(discrete = TRUE, alpha=0.6, option="A") +
theme(
legend.position="none", # Got rid of the legend (I don't need it here)
plot.title = element_text(size=11)
) +
ggtitle("Victims of Mass Shootings from 2000-2017") + # Gave my visualization a descriptive title
xlab("")
analysis1
The first thing I noticed here is the outlier for the year 2017– the 547 total victims of the Las Vegas Strip massacre. It is definitely effecting my ability to make any connections in the data, so I decided that for the sake of my analysis, I am going to remove this data point. This was a difficult decision to make considering that the LAs Vegas Massacre had such a huge impact on the discussion of guns in America, but for the sake of the rest of the data, I had to remove it.
stat_analysis2 <- stat_analysis[stat_analysis$`Total victims` != "547",] # Removed the data point for the LA Massacre so it wouldn't show in my analysis
analysis1.2 <- ggplot(stat_analysis2, aes(x=Year, y=`Total victims`, group=Year)) +
geom_boxplot() +
scale_fill_viridis(discrete = TRUE, alpha=0.6, option="A") +
theme(
legend.position="none",
plot.title = element_text(size=11)
) +
ggtitle("Victims of Mass Shootings from 2000-2017") +
xlab("") +
stat_summary(fun.y = "mean", geom = "point", shape = 23, size = 2, fill = "white") # Used the stat_summary command so that the mean of each year's mass shooting victims would be visible on the boxplots
## Warning: `fun.y` is deprecated. Use `fun` instead.
analysis1.2
Looking at the data at the data after removing the Las Vegas outlier, I can definitely see how mass shootings have both increased in number every year, as well as severity. After 2006, the amount of mass shootings increased, and outliers (meaning more severe mass shootings) increase as well. Although the average number of victims per year have remained around the same (which I can see because of the mean points that I added), the outliers show how individual cases of mass shootings have become much deadlier (and more frequent) after 2006 then before.
The first thing I was interested in seeing was how race played a factor (if it played any at all) in the number of mass shootings. I created multiple histograms in order to see how the data was spread out through different racial categories.
# Created multiple histograms using the ggplot package
ggplot(ms_clean, aes(x=Year)) +
geom_histogram(fill = "white", colour = "black") +
facet_grid(Race ~ ., scales = "free")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Based on this visualizaton, I can see that the most amount of mass shootings happen at the hands of people in the White category, followed Black people, and then Latino people. This is something I’d like to explore further: Why is this so?
The next thing I wanted to explore was how mental illness played a role in US mass shootings. Every time mass shootings make headlines, it is almost always mentioned how there were some kind of mental issues with the perpetrator, and I wanted to see if this is as significant of a factor as the media says it is.
ggplot(ms_clean, aes(x=Year)) +
geom_histogram(fill = "white", colour = "orange") +
facet_grid(`Prior signs of mental health issues` ~ ., scales = "free")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Based on these histograms, I can say that yes, based on the data, most mast shooters did display prior signs of mental illness. However, I This interests me because I would think that if caught on early and treated properly, these events can be avoided, and people’s lives could be saved.
For my first visualization, I wanted to show the role that mental illness might play in mass shootings. Based on my prior analysis, I know that there might be some sort of relationship between the two because of the sheer number of cases where the mass shooters displayed prior signs of mental illness. I decided the best way to show this was through a stacked bar chart.
As a side note, for both visualizations I decided to narrow down the years from 2000 till 2017 in order to make the data easier to view.
vis1 <- ms_clean %>% # First I filtered my data to make it easier to work with when coding the visualization
filter(Year %in% c('2017', '2016', '2015', '2014', '2013', '2012', '2011', '2010', '2009', '2008', '2007', '2006', '2005', '2004', '2003', '2001', '2000')) %>%
select(Case, Year,`Prior signs of mental health issues`)
as.data.frame(vis1)
## Case Year
## 1 Texas First Baptist Church massacre 2017
## 2 Walmart shooting in suburban Denver 2017
## 3 Edgewood businees park shooting 2017
## 4 Las Vegas Strip massacre 2017
## 5 San Francisco UPS shooting 2017
## 6 Pennsylvania supermarket shooting 2017
## 7 Florida awning manufacturer shooting 2017
## 8 Rural Ohio nursing home shooting 2017
## 9 Fresno downtown shooting 2017
## 10 Fort Lauderdale airport shooting 2017
## 11 Cascade Mall shooting 2016
## 12 Baton Rouge police shooting 2016
## 13 Dallas police shooting 2016
## 14 Orlando nightclub massacre 2016
## 15 Excel Industries mass shooting 2016
## 16 Kalamazoo shooting spree 2016
## 17 San Bernardino mass shooting 2015
## 18 Planned Parenthood clinic 2015
## 19 Colorado Springs shooting rampage 2015
## 20 Umpqua Community College shooting 2015
## 21 Chattanooga military recruitment center 2015
## 22 Charleston Church Shooting 2015
## 23 Trestle Trail bridge shooting 2015
## 24 Marysville-Pilchuck High School shooting 2014
## 25 Isla Vista mass murder 2014
## 26 Fort Hood shooting 2 2014
## 27 Alturas tribal shooting 2014
## 28 Washington Navy Yard shooting 2013
## 29 Hialeah apartment shooting 2013
## 30 Santa Monica rampage 2013
## 31 Pinewood Village Apartment shooting 2013
## 32 Mohawk Valley shootings 2013
## 33 Sandy Hook Elementary massacre 2012
## 34 Accent Signage Systems shooting 2012
## 35 Sikh temple shooting 2012
## 36 Aurora theater shooting 2012
## 37 Seattle cafe shooting 2012
## 38 Oikos University killings 2012
## 39 Su Jung Health Sauna shooting 2012
## 40 Seal Beach shooting 2011
## 41 IHOP shooting 2011
## 42 Tucson shooting 2011
## 43 Hartford Beer Distributor shooting 2010
## 44 Coffee shop police killings 2009
## 45 Fort Hood massacre 2009
## 46 Binghamton shootings 2009
## 47 Carthage nursing home shooting 2009
## 48 Atlantis Plastics shooting 2008
## 49 Northern Illinois University shooting 2008
## 50 Kirkwood City Council shooting 2008
## 51 Westroads Mall shooting 2007
## 52 Crandon shooting 2007
## 53 Virginia Tech massacre 2007
## 54 Trolley Square shooting 2007
## 55 Amish school shooting 2006
## 56 Capitol Hill massacre 2006
## 57 Goleta postal shootings 2006
## 58 Red Lake massacre 2005
## 59 Living Church of God shooting 2005
## 60 Damageplan show shooting 2004
## 61 Lockheed Martin shooting 2003
## 62 Navistar shooting 2001
## 63 Wakefield massacre 2000
## Prior signs of mental health issues
## 1 Yes
## 2 Unclear
## 3 Unclear
## 4 TBD
## 5 Yes
## 6 Unclear
## 7 Unclear
## 8 Yes
## 9 Unclear
## 10 Yes
## 11 Yes
## 12 Yes
## 13 Unclear
## 14 Unclear
## 15 Unclear
## 16 Unclear
## 17 Unclear
## 18 Unclear
## 19 Unclear
## 20 Unclear
## 21 Unclear
## 22 Unclear
## 23 Yes
## 24 Unclear
## 25 Yes
## 26 Unclear
## 27 Unknown
## 28 Yes
## 29 Unclear
## 30 Yes
## 31 No
## 32 No
## 33 Yes
## 34 Yes
## 35 Yes
## 36 Yes
## 37 Yes
## 38 Yes
## 39 Yes
## 40 Yes
## 41 Yes
## 42 Yes
## 43 No
## 44 Yes
## 45 Unclear
## 46 Yes
## 47 Yes
## 48 No
## 49 Yes
## 50 No
## 51 Yes
## 52 Unclear
## 53 Yes
## 54 Unclear
## 55 No
## 56 No
## 57 Yes
## 58 Yes
## 59 Yes
## 60 Yes
## 61 Yes
## 62 No
## 63 Yes
head(vis1)
## Case Year Prior signs of mental health issues
## 1 Texas First Baptist Church massacre 2017 Yes
## 2 Walmart shooting in suburban Denver 2017 Unclear
## 3 Edgewood businees park shooting 2017 Unclear
## 4 Las Vegas Strip massacre 2017 TBD
## 5 San Francisco UPS shooting 2017 Yes
## 6 Pennsylvania supermarket shooting 2017 Unclear
# I used ggplot to create the bar graph
vis1 <- ggplot(vis1, aes(Year))
vis1 + geom_bar(aes(fill=`Prior signs of mental health issues`), width = 0.5) +
labs(title="Signs of Prior Mental Health Issues in Mass Shooting Cases",
subtitle="(In the 21st Century)",
caption= "Data from Mother Jones and the Foundation for National Progress") + # I gave my visualization a title, subtitle, and caption used the labs command
xlab("Year")+
ylab("Cases")+ # Labeled my axes
theme_bw() + # Changed my theme from the default ggplot one
scale_fill_viridis_d() # Used the viridis package to change my color scheme
For my interactive visualization I really wanted to display as much of the information for each case as possible. I wanted to be able to show characteristics of mass shooting cases, such as the specific case, the number of people injured and killed, and the race and gender of the mass shooter. More specifically though, I wanted to see if there were any patterns between race and mass shootings. Although I have seen numerous headlines connecting these factors (for example, how white males are more likely to commit these acts), I wanted to see for myself through the specific data.
I decided to use the highcharter package to create a scatterplot of the data showing the cases over time.
library(highcharter)
## Warning: package 'highcharter' was built under R version 4.0.4
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
## Highcharts (www.highcharts.com) is a Highsoft software product which is
## not free for commercial and Governmental use
vis2 <- ms_clean %>%
filter(Year %in% c('2017', '2016', '2015', '2014', '2013', '2012', '2011', '2010', '2009', '2008', '2007', '2006', '2005', '2004', '2003', '2001', '2000')) %>%
select(Case, Year, Fatalities, Injured, `Total victims`, Venue, `Prior signs of mental health issues`, Race, Gender)
vis2 <- vis2[-c(4),]
head(vis2)
## Case Year Fatalities Injured Total victims
## 1 Texas First Baptist Church massacre 2017 26 20 46
## 2 Walmart shooting in suburban Denver 2017 3 0 3
## 3 Edgewood businees park shooting 2017 3 3 6
## 5 San Francisco UPS shooting 2017 3 2 5
## 6 Pennsylvania supermarket shooting 2017 3 0 3
## 7 Florida awning manufacturer shooting 2017 5 0 5
## Venue Prior signs of mental health issues Race Gender
## 1 Religious Yes White Male
## 2 Other Unclear White Male
## 3 Workplace Unclear Black Male
## 5 Workplace Yes Asian Male
## 6 Workplace Unclear White Male
## 7 Workplace Unclear N/A Male
highchart() %>%
hc_add_series(data = vis2,
type = "scatter", # Decided to make a scatterplot by setting the type to 'scatter'
hcaes(x = Year, # Designated my x-axis, y-xis, and the variable I wanted to plot
y = `Total victims`,
size = Fatalities,
group = Race), # Defined the variables I wanted to use
tooltip = list(pointFormat = # Edited my tooltip to display the information
"Case: {point.Case}<br>
Year: {point.Year}<br>
Fatalities: {point.Fatalities}<br>
Injuries: {point.Injured}<br>
Total Victims: {point.y}<br>
Gender: {point.Gender} <br>
Prior Signs of Mental Health Issues: {point.Prior signs of mental health issues}")
) %>%
hc_add_theme(hc_theme_economist()) %>% # Changed the theme
hc_title(text = "U.S. Mass Shootings in the 21st Century", # Added a title and subtitle
margin = 20, align = "center",
style = list(color = "#002266", useHTML = TRUE)) %>%
hc_subtitle(text = "A glance at the characteristics and severity of mass shootings since 2000",
align = "center", style = list(color = "#fffff", fontWeight = "bold")) %>%
hc_xAxis(categories = c("2000", "2001", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012", "2013", "2014" ,"2015", "2016", "2017"), # Edited my x-axis
tickmarkPlacement = "on",
title = list(enabled = FALSE)) %>%
hc_xAxis(title = list(text="Year")) %>%
hc_yAxis(title = list(text="Total Victims (Injured or Killed)")) %>% # Added labels to my axes
hc_legend(align = "right", verticalAlign = "bottom",
layout = "vertical") %>% # Added a legend
hc_tooltip(enabled = TRUE) # Enabled tooltip
For this project, I wanted to explore mass shootings in recent decades in the United States and the factors that played into these horrific events. I used the ‘US Mass Shootings’ data set provided by Mother Jones and the Foundation for National Progress. This data set included categorical variables, numerical variables, and descriptive variables (I went into this in more detail in my introduction). It was quite a large dataset with a lot of information, so to make it easier to work with I had to do a bit of cleaning. The major cleaning that I did was selecting the variables that I was most interested in and wanted to work with and filtering out the variables that would be difficult to work with or create comprehensive visualizations out of. For example, the ‘summary’ variable in this data set provided a brief summary of each case and the events that played out before, during, and after the incidents. Although this is very informative and interesting, it didn’t make sense to use it in my visualizations. I used the dplyr ‘select’ and ‘filter’ commands to do this. Another way I made my data easier to work with was by filtering out the data on years before 2000. This would allow me to look at the 21st century specifically and would help make my visualization look less overwhelming. I decided to work with this dataset for this project because gun control is a major passion of mine; I’ve been to multiple protests and rallies as well as spoken with victims of mass shootings, so this issue is quite personal to me. Through my explorations, I wanted to understand why mass shootings occur so often in the US, and why they’ve become more frequent and deadly in recent years.
Mass shootings in the US have been a subject of heated debate for years now, notably since the Sandy Hook Elementary School shooting in 2012, which killed 26 people. Of those 26 people, 20 were children ages 6-7; the cruelty and horror of this incident sparked discussions about gun control in America, and those discussions stay prominent to this day. In my visualizations, I explored two factors of mass shooters that Americans point to time and time again: race and mental illness. When it comes to the influence of race on mass shootings, the subject is tricky. Based on information provided by criminologist James Alan Fox at Northeastern University, more than half of perpetrators of mass shootings are white. This information is also reflected in my visualization: the majority of mass shootings in the US since 2000 have been perpetrated by white men. However, after more research, I learned that race is not as significant of a factor as the media makes it seem. According to the Statista Research Department, “broadly speaking, the racial distribution of mass shootings mirrors the racial distribution of the U.S. as a whole.” This means that the reason that white people represent the majority of mass shooters is heavily due to the fact that the majority population of the US is white. I found this to be eye-opening and revealing, as a lot of the information and opinions shared on social media exaggerate the factor of race in mass shootings.
The other factor that I explored was the role of mental illness in mass shootings. Based on my own experiences interacting with news media and social media, mental illness has been pointed to many times after mass shootings. Calls for improving mental health services have risen, as people believe that this would be a solid preventative measure when it comes to mass shootings. People do not have this concern baselessly– the Statista Research Department states that in over half the mass shootings since 1982, the perpetrator showed prior signs of mental health issues. Again, I observed this pattern in my visualization as well. However, after more research, new studies find that the “emphasis on serious mental illness [in discussions of mass shootings and mass murder]…is undue emphasis” and serves to stigmatize illnesses such as schizophrenia and psychotic mood disorders more than they already are.
In the future, I’d like to explore the variables related to weapons in this dataset, such as the type of weapon used and whether it was obtained legally. Considering that guns specifically are tied into mass shooting incidents intimately, it is a factor that I would like to research more on.