library(jsonlite)
library(tidyverse)
library(tibble)
library(knitr)

Data Management and Acquisition Final Project Proprosal

Mass and School Shooting in America Analysis

Background

Not only is the topic of Gun Violence in America considered to be a \("hot"\) \("topic"\) for debate, the School and Mass Shooting epidemic in this country is one that can " hit slose to home" for most of us. During the research phase of this project, I could not decide whether I was going to focus just on \("School"\) related shooting or stick with \("Mass"\) shootings as a whole. Therefore, I’m going to use both for this analysis. Using the School Shooting Dataset as a subset of the overall Mass Shooting Dataset. Performing analysis along the way. For instances, one of these statistical measures can be, Which percent of mass shootings happen on K-12 School Campuses?

Data Sources

Open Data Soft - Mass Shooting in America

linked phrase

Center for Homeland Defense and Security - K-12 School Shooting Database

linked phrase

Data Import & Initial Tidying

Mass Shooting Data

json_mass_file <-"https://raw.githubusercontent.com/josephsimone/Data_607_Final_Project/master/mass-shootings-in-america.json"
mass <- fromJSON(json_mass_file)
mass_tbl<-as.data.frame(mass)
mass_tbl<-as_tibble(mass_tbl)
head(mass_tbl)
## # A tibble: 6 x 5
##   datasetid recordid fields$history_~ $school_related $shooter_name
##   <chr>     <chr>    <chr>            <chr>           <chr>        
## 1 mass-sho~ 837e511~ The shooter did~ No              Silvio Izqui~
## 2 mass-sho~ 3242d1c~ None             Yes             Nicco Tatum  
## 3 mass-sho~ 1774a9d~ Unknown          No              Herman Derico
## 4 mass-sho~ d00d3de~ Unknown          No              Malachi Russ~
## 5 mass-sho~ a0274a2~ Unknown          No              Matthew Wats~
## 6 mass-sho~ ab8dd3d~ Unknown          No              Lawrence A. ~
## # ... with 49 more variables: $type_of_gun_detailed <chr>,
## #   $number_of_victims_injured <dbl>, $date <chr>, $longitude <dbl>,
## #   $date_detailed <chr>, $place_type <chr>, $city <chr>,
## #   $shooter_age_s <dbl>, $total_number_of_fatalities <dbl>,
## #   $targeted_victim_s_general <chr>, $number_of_handguns <dbl>,
## #   $state <chr>, $number_of_semi_automatic_guns <dbl>,
## #   $number_of_rifles <dbl>, $targeted_victim_s_detailed <chr>,
## #   $location <chr>, $possible_motive_general <chr>,
## #   $average_shooter_age <dbl>, $number_of_automatic_guns <dbl>,
## #   $history_of_mental_illness_general <chr>,
## #   $relationship_to_incident_location <chr>, $data_source_3 <chr>,
## #   $description <chr>, $type_of_gun_general <chr>, $data_source_1 <chr>,
## #   $data_source_2 <chr>, $military_experience <chr>,
## #   $data_source_4 <chr>, $fate_of_shooter_at_the_scene <chr>,
## #   $number_of_shotguns <dbl>, $total_number_of_victims <dbl>,
## #   $shooter_race <chr>, $class <chr>, $shooter_s_cause_of_death <chr>,
## #   $latitude <dbl>, $geopoint <list>, $caseid <dbl>, $day_of_week <chr>,
## #   $total_number_of_guns <dbl>, $number_of_victim_fatalities <dbl>,
## #   $possible_motive_detailed <chr>, $title <chr>, $shooter_sex <chr>,
## #   $data_source_5 <chr>, $data_source_6 <chr>, $data_source_7 <chr>,
## #   geometry$type <chr>, $coordinates <list>, record_timestamp <chr>

School Shooting Data

school_file <- read_csv(file ="https://raw.githubusercontent.com/josephsimone/Data_607_Final_Project/master/K-12%20SSDB%20(Public)%20-%20K-12%20SSDB%20(Public)%20Linked.csv")
head(school_file)
## # A tibble: 6 x 47
##   `Updated 11/13/~ X2    X3    X4    X5    X6    X7    X8    X9    X10  
##   <chr>            <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
## 1 Date             Scho~ City  State Reli~ Kill~ Woun~ Tota~ Gend~ Vict~
## 2 1/5/1970         Hine~ Wash~ DC    3     1     0     1     Male  Stud~
## 3 1/5/1970         Sous~ Wash~ DC    3     0     1     1     Male  Stud~
## 4 1/5/1970         Unna~ Wash~ DC    2     0     0     0     No V~ No V~
## 5 2/6/1970         John~ Clev~ OH    2     0     1     1     Male  Stud~
## 6 3/23/1970        Davi~ Long~ CA    2     0     2     2     Male  Mult~
## # ... with 37 more variables: X11 <chr>, X12 <chr>, X13 <chr>, X14 <chr>,
## #   X15 <chr>, X16 <chr>, X17 <chr>, X18 <chr>, X19 <chr>, X20 <chr>,
## #   X21 <chr>, X22 <chr>, X23 <chr>, X24 <chr>, X25 <chr>, X26 <chr>,
## #   X27 <chr>, X28 <chr>, X29 <chr>, X30 <chr>, X31 <chr>, X32 <chr>,
## #   X33 <chr>, X34 <chr>, X35 <chr>, X36 <chr>, X37 <chr>, X38 <chr>,
## #   X39 <chr>, X40 <chr>, X41 <chr>, X42 <chr>, X43 <chr>, X44 <chr>,
## #   X45 <chr>, X46 <chr>, X47 <chr>
colnames(school_file) = school_file[1, ]
colnames(school_file) = school_file[1, ]
school_file = school_file[-1, ]
head(school_file)
## # A tibble: 6 x 47
##   Date  School City  State `Reliability Sc~ `Killed (includ~ Wounded
##   <chr> <chr>  <chr> <chr> <chr>            <chr>            <chr>  
## 1 1/5/~ Hine ~ Wash~ DC    3                1                0      
## 2 1/5/~ Sousa~ Wash~ DC    3                0                1      
## 3 1/5/~ Unnam~ Wash~ DC    2                0                0      
## 4 2/6/~ John ~ Clev~ OH    2                0                1      
## 5 3/23~ David~ Long~ CA    2                0                2      
## 6 4/15~ Pine ~ Pine~ AR    3                1                5      
## # ... with 40 more variables: `Total Injured/Killed Victims` <chr>,
## #   `Gender of Victims (M/F/Both)` <chr>, `Victim's Affiliation w/
## #   School` <chr>, `Victim's age(s)` <chr>, `Victims Race` <chr>, `Victim
## #   Ethnicity` <chr>, `Targeted Specific Victim(s)` <chr>, `Random
## #   Victims` <chr>, `Bullied (Y/N/ N/A)` <chr>, `Domestic Violence
## #   (Y/N)` <chr>, `Suicide (Shooter was only victim) Y/N/ N/A` <chr>,
## #   `Suicide (shot self immediately following initial shootings) Y/N/
## #   N/A` <chr>, `Suicide (e.g., shot self at end of incident - time period
## #   between first shots and suicide, different location, when confronted
## #   by police) Y/N/ N/A` <chr>, `Suicide (or attempted suicide) by Shooter
## #   (Y/N)` <chr>, `Shooter's actions immediately after shots fired` <chr>,
## #   `Pre-planned school attack` <chr>, Summary <chr>, Category <chr>,
## #   `School Type` <chr>, `Narrative (Detailed Summary/ Background)` <chr>,
## #   Sources <chr>, `Time of Occurrence (12 hour AM/PM)` <chr>, `Duration
## #   (minutes)` <chr>, `Day of week (formula)` <chr>, `During School Day
## #   (Y/N)` <chr>, `Time Period` <chr>, Location <chr>, `Number of Shots
## #   Fired` <chr>, `Firearm Type` <chr>, `Number of Shooters` <chr>,
## #   `Shooter Name` <chr>, `Shooter Age` <chr>, `Shooter Gender` <chr>,
## #   Race <chr>, `Shooter Ethnicity` <chr>, `Shooter's Affiliation with
## #   School` <chr>, `Shooter had an accomplice who did not fire gun
## #   (Y/N)` <chr>, `Hostages Taken (Y/N)` <chr>, NA <chr>, NA <chr>