Overview

The article that I choose from fivethirtyeight.com was Do You Know Where America Stands on Guns? The article discuss if American’s support stricter gun laws and conducted a poll for American’s after the shooting in Stoneman Douglas High School in Parkland, Florida. The data was collected after a shooting therefore the data may be skewed due to recent events. The polls suggested more than 50% of American’s would want stricter laws on gun purchase. At the same time they did not want to ban the opportunity for American’s to purchase assault weapons

Link to the article:Do You Know Where America Stands on Guns?

Load Library

Load the packages to R

library(tidyverse)
library(ggplot2)

Load the .csv into a dataframe

Loading the .csv file into the data frame gun_poll

gun_poll <-  read_csv("https://raw.githubusercontent.com/AnnaMoy/Data-607/main/guns-polls.csv")

Rename the columns

Renaming the columns in the data frame to a consistent format

colnames(gun_poll) <- c("question","start_date", "end_date", "pollster","adult_reg","sup", "rep_sup", "demo_supp", "web")

Find the Mean and Median

Find the mean and median for those are supporters and are adults or registered voters

gun_poll %>%
  group_by(adult_reg) %>%
  summarize(mean_sup = mean(sup), median_sup = median(sup))
## # A tibble: 2 × 3
##   adult_reg         mean_sup median_sup
##   <chr>                <dbl>      <dbl>
## 1 Adults                67.4         72
## 2 Registered Voters     67.9         68

Select a subset of the dataframe columns

Select only Adults and the # of supports data and columns

adults <- subset(gun_poll, adult_reg == "Adults" & sup > 0, select = c(adult_reg, sup))
adults
## # A tibble: 13 × 2
##    adult_reg   sup
##    <chr>     <dbl>
##  1 Adults       82
##  2 Adults       67
##  3 Adults       44
##  4 Adults       43
##  5 Adults       41
##  6 Adults       75
##  7 Adults       94
##  8 Adults       53
##  9 Adults       72
## 10 Adults       73
## 11 Adults       92
## 12 Adults       75
## 13 Adults       65

Bar Plot

What is the number of respondents that check the weather?

Conclusion

The poll was conducted after a shooting my suggestion is conduct another poll afterwards to see if the prespectives of the Americans have changed on their idea of having stricter gun laws. It will allow us to see if there is a correlation between a recent shooting versus no recent shootings.