Load the three required packages. We have used the first two before but the last package is called data base. This package allows us to use wikipedia to analyze the searches done over periods of time

## ── Attaching packages ────────────────────────────────────────── tidyverse 1.2.1 ──
## ✔ ggplot2 3.1.0     ✔ purrr   0.3.0
## ✔ tibble  2.0.1     ✔ dplyr   0.7.8
## ✔ tidyr   0.8.2     ✔ stringr 1.3.1
## ✔ readr   1.3.1     ✔ forcats 0.3.0
## ── Conflicts ───────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()

Get the views of the Gun control wikipedia article. By doing this we are allowing us to look at all the number of times people have searched/look at Gun control article in wikipedia between these given dates. We also labeled it under guns for later use.

guns <- article_pageviews(article = "Gun control", start = as.Date("2015-7-1"), end = as.Date("2018-12-31"))

Here we wanted to graph the views of the Gun control article over time. We labeled the graph which is what you will see in the labs command. We also set the line color to blue which is what you will see in the geom_line command.

guns %>% 
  ggplot(aes(x = date, y= views))+
  geom_line(color= "blue")+
  labs(x= "Date",
       y= "Views",
       title= "Views of the Wikipedia Gun control artivle over time")

Here we wanted to make a table of the views of the article from greatest to least. You can see That on february 16th there were 6549 views to the Gun control article. You can also see that most of the top views came from 2018 except for #7 which was from 2016.

guns %>%
  select(date, views) %>%
  arrange(-views) %>% 

First, you have to look up the dates that the shootings actually happened. They are listed below. Las Vegas shooting Ocotber 1, 2017 Florida shooting Febuary 15, 2017 Here I created a table of the top searches for the day after the Las Vegas shooting. I also filtered out the results for the main page and the special search since those are not anything people actually searched for. You can see that the Vegas shooting was the fourth most searched.

top_articles(start= as.Date("2017- 10- 2")) %>%
  select(article, views) %>% 
  filter(!article== "Main_Page", !article == "Special:Search") %>%