Introduction

Agenda-setting theory argues that the amount of attention the media gives to an issue can influence how important audiences believe that issue is.

This project applies agenda-setting theory to sports news by comparing online news coverage of NASCAR and the National Hockey League (NHL).

Hypothesis

The media will devote more coverage to the NHL than to NASCAR.

Variables

The independent variable is the sports league, with two categories: NASCAR and the NHL.

The dependent variable is online news coverage, measured using story counts returned by Media Cloud.

Method

Media Cloud was used to retrieve daily online news story counts from October 19, 2025, through October 17, 2026. Daily counts were combined into weekly totals to compare coverage over time.

The NASCAR search included NASCAR, NASCAR Cup Series, NASCAR Xfinity Series, and NASCAR Truck Series. The NHL search included National Hockey League, NHL, and Stanley Cup.

Code

Download the data

## # A tibble: 6 × 5
##   date       total_count count   ratio topic 
##   <date>           <int> <int>   <dbl> <chr> 
## 1 2025-10-19        7679    80 0.0104  NASCAR
## 2 2025-10-20       12169    54 0.00444 NASCAR
## 3 2025-10-21       14082    44 0.00312 NASCAR
## 4 2025-10-22       14440    45 0.00312 NASCAR
## 5 2025-10-23       14373    28 0.00195 NASCAR
## 6 2025-10-24       13272    31 0.00234 NASCAR

Weekly News Coverage

The daily story counts are combined into weekly totals. Weeks begin on Sunday.

Summary Statistics for NASCAR and NHL News Coverage
Topic Total Story Counts Weekly Minimum Weekly Maximum Weekly Median Weekly Mean Weekly SD
NHL 83646 405 2539 1741.5 1608.58 613.09
NASCAR 15520 112 832 278.0 298.46 112.82

Interactive Graph

The graph compares weekly news coverage for both sports. Hover over a point to see the topic, week, and story count.

Results

These results support the hypothesis that the NHL received more news coverage than NASCAR, according to Media Cloud. The difference is substantial in the returned story counts. NHL recieved around 83,000 while NASCAR received only 15,000 (which makes sense, I am huge NASCAR fan, sadly the sports dead)

For agenda-setting perspective, it clearly shows that the NHl received more attention. however we can not 100% guarantee the additional media coverage added more viewers. One could assume it has no relevance due to NASCAR’s viewership numbers which are much higher on a weekly basis compared to the NHL. According to the Sports Business Journal, the NHL is seeing a spike in viewership, maybe due to the increased media attention?

Code

# Load packages
library(tidyverse)
library(lubridate)
library(httr2)
library(plotly)
library(knitr)
library(kableExtra)

# Load Media Cloud API key
mc_key <- Sys.getenv("MEDIACLOUD_KEY")

# Set study dates
start_date <- "2025-10-19"
end_date <- "2026-10-17"

# Define search queries
nascar_query <- '(NASCAR OR "NASCAR Cup Series" OR "NASCAR Xfinity Series" OR "NASCAR Truck Series")'
nhl_query <- '("National Hockey League" OR NHL OR "Stanley Cup")'

topics <- c(
  "NASCAR" = nascar_query,
  "NHL" = nhl_query
)

# Create Media Cloud download function
mc_counts_over_time <- function(
  query,
  start_date,
  end_date,
  collection_id = 34412234
) {
  resp <- request(
    "https://search.mediacloud.org/api/search/count-over-time"
  ) |>
    req_headers(
      Authorization = paste("Token", mc_key)
    ) |>
    req_url_query(
      q = query,
      start = start_date,
      end = end_date,
      platform = "onlinenews-mediacloud",
      cs = collection_id
    ) |>
    req_perform()

  results <- resp |> resp_body_json()

  map_dfr(
    results$count_over_time$counts,
    as_tibble
  ) |>
    mutate(date = as.Date(date))
}

# Download topic data
topic_data <- imap_dfr(
  topics,
  function(search_string, topic_name) {
    results <- mc_counts_over_time(
      query = search_string,
      start_date = start_date,
      end_date = end_date
    )

    results |>
      mutate(topic = topic_name)
  }
)

# View downloaded data
head(topic_data)

# Calculate weekly story counts
weekly_counts <- topic_data |>
  mutate(
    week = floor_date(
      date,
      unit = "week",
      week_start = 7
    )
  ) |>
  group_by(topic, week) |>
  summarise(
    stories = sum(count),
    .groups = "drop"
  )

# Calculate summary statistics
topic_summary <- weekly_counts |>
  group_by(topic) |>
  summarise(
    Total_Stories = sum(stories),
    Weekly_Minimum = min(stories),
    Weekly_Maximum = max(stories),
    Weekly_Median = median(stories),
    Weekly_Mean = round(mean(stories), 2),
    Weekly_SD = round(sd(stories), 2),
    .groups = "drop"
  ) |>
  arrange(desc(Total_Stories))

# Display summary statistics
print(topic_summary)

# Prepare graph data
weekly_counts <- weekly_counts |>
  mutate(
    stories_formatted = formatC(
      stories,
      format = "d",
      big.mark = ","
    )
  )

# Create interactive graph
Graph <- plot_ly(
  data = weekly_counts,
  x = ~week,
  y = ~stories,
  color = ~topic,
  colors = "Set1",
  type = "scatter",
  mode = "lines+markers",
  customdata = ~topic,
  text = ~stories_formatted,
  hovertemplate = paste(
    "<b>%{customdata}</b><br>",
    "Week: %{x|%Y-%m-%d}<br>",
    "Story counts: %{text}<br>",
    "<extra></extra>"
  )
) |>
  layout(
    title = "Weekly Online News Coverage: NASCAR vs. NHL",
    hovermode = "x unified",
    xaxis = list(title = "Week"),
    yaxis = list(
      title = "Weekly Story Count",
      separatethousands = TRUE
    ),
    legend = list(
      title = list(text = "Sports Topic")
    )
  )

# Display graph
Graph