gun_control |>ggplot(aes(x = date, y = views)) +geom_line()
Mass <-article_pageviews(article ="Mass shootings in the United States", start =as.Date("2017-1-1"), end =as.Date("2023-12-31"))Mass |>datatable()
guns <-bind_rows(gun_control, Mass)
guns |>ggplot(aes(x = date, y = views, color = article)) +geom_line()
PROBLEM SECTION
guns |>pivot_wider(names_from = article, values_from = views) |>ggplot(aes(x = Mass_shootings_in_the_United_States, y = Gun_control)) +# create scatterplotgeom_point() +geom_smooth(method = lm) +# create regression linelabs(x ="Views of the Wikipedia Mass,.... in the US article", y ="Views of the Wikipedia Gun control article", title ="Relationship between Wikipedia article views")
April 15, 2023 in Dadevile, Alabama (2023 - 04 - 15) shooter open-fired at a birthday party with 4 dead, 32 injured, and 6 suspects taken into custody.
shootings <-bind_rows(maine, alabama)shootings |>ggplot(aes(x = day, y = views, color = event)) +geom_line() +theme_minimal() +labs(x ="Days before/after Shooting", y ="Wikipedia Views", color ="Event", title ="Views of the Wikipedia Gun Control Article before and after Two Mass Shootings")
second <-top_articles(start =as.Date("2023-10-25"))
second |>select(article, views) |>filter(!article =="Main_Page", !article =="Special:Search") |>top_n(10, views) |>ggplot(aes(x =fct_rev(as_factor(article)), y = views)) +geom_col(fill ="blue") +coord_flip() +scale_y_continuous(labels = scales::comma) +labs(y ="Number of Views", x ="Article", title ="Top Wikipedia articles, April 16, 2023")
The Alabama shooting took place on April 15th, so I put in April 16th to see what the top article views of the day were after it took place. It does not appear to be in the top article views.
second |>select(article, views) |>filter(!article =="Main_Page", !article =="Special:Search") |>datatable()
These are the top article views for the Alabama shooting day.
first <-top_articles(start =as.Date("2023-10-25"))
first |>select(article, views) |>filter(!article =="Main_Page", !article =="Special:Search") |>top_n(10, views) |>ggplot(aes(x =fct_rev(as_factor(article)), y = views)) +geom_col(fill ="blue") +coord_flip() +scale_y_continuous(labels = scales::comma) +labs(y ="Number of Views", x ="Article", title ="Top Wikipedia articles, October 26, 2023")
These are the top article views for October 26th, the day following the Maine shooting. Once again, the shooting and gun violence does not appear to be in the top 10 list.
first |>select(article, views) |>filter(!article =="Main_Page", !article =="Special:Search") |>datatable()
This is a table for the Maine shooting day.
gun_control <-article_pageviews(article ="Gun control", start =as.Date("2023-4-8"), end =as.Date("2023-4-22"))glimpse(gun_control)
shootings <-bind_rows(maine, alabama)shootings |>ggplot(aes(x = day, y = views, color = event)) +geom_line() +theme_minimal() +labs(x ="Days before/after Shooting", y ="Wikipedia Views", color ="Event", title ="Views of the Wikipedia Gun Control Article before and after Two Mass Shootings")
Warning: The statistic is based on a difference or ratio; by default, for
difference-based statistics, the explanatory variable is subtracted in the
order "TRUE" - "FALSE", or divided in the order "TRUE" / "FALSE" for
ratio-based statistics. To specify this order yourself, supply `order =
c("TRUE", "FALSE")`.
# A tibble: 2 × 4
after_event Mean StdDev N
<lgl> <dbl> <dbl> <int>
1 FALSE 525. 179. 16
2 TRUE 580. 97.2 14
This t-test shows that the average number of views for the Wikipedia Gun Control article in the 7 days before the two shootings (M = 525.3, SD = 179.1) was not statistically significantly different from the average number of views in the 7 days folowing the shooting (M = 579.5, SD = 97.2), t(23.7) = 1.05, p = .306.