I compared media coverage of Donald Trump and Taylor Swift beginning January 1, 2024 until August 30, 2025. GDELT helped discover there was more media coverage of now-president Trump than the international popstar.
This chart compares daily counts of online articles mentioning “Donald Trump” and Taylor Swift” for the last year-and-a-half. The beginning of the coverage feature Trump campaigning for his second term as president and just as Swift ends her more than two-year long international tour. The end of the coverage, present day, comes Labor Day weekend as the latest tariff news hits the newscycle, and as rumors of the president’s death are going viral on multiple social media platforms; and just days after Swift got engaged to her longtime NFL player boyfriend and announced a new album. Swift has been vocal about her dislike for Trump on her social media accounts and in news reports. Trump, likewise, has also deemed Swift as “very liberal” and “no longer hot,” among other things.
The examples mentioned above demonstrate how agenda setting theory can shape the opinions of viewers by what stories about Trump and Swift are presented to viewers. Other factors could influence the amount of attention the public pays to either topic.
Here is the R script that gathered the data and produced the chart.
# Installing and loading the tidyverse, plotly, and readr packages
if (!require("tidyverse"))
install.packages("tidyverse")
if (!require("plotly"))
install.packages("plotly")
if (!require("readr"))
install.packages("readr")
library(tidyverse)
library(plotly)
library(readr)
# Specifying date range
startdate <- "20240101"
enddate <- "20250830"
# -----------------------------
# Gathering data for Topic A: Donald Trump
# -----------------------------
query <- "'Donald Trump' SourceCountry:US"
# Build API request
vp1 <- "https://api.gdeltproject.org/api/v2/doc/doc?query="
vp2 <- "&mode=timelinevolraw&startdatetime="
vp3 <- "000000&enddatetime="
vp4 <- "000000&format=CSV"
text_v_url <- paste0(vp1, query, vp2, startdate, vp3, enddate, vp4)
v_url <- URLencode(text_v_url)
Volume <- read_csv(v_url)
# Clean and filter
Volume$Date <- as.Date(Volume$Date, "%Y-%m-%d")
Volume <- Volume %>% filter(Series == "Article Count")
VolumeA <- Volume # Trump data
# -----------------------------
# Gathering data for Topic B: Taylor Swift
# -----------------------------
query <- "'Taylor Swift' SourceCountry:US"
# Build API request
text_v_url <- paste0(vp1, query, vp2, startdate, vp3, enddate, vp4)
v_url <- URLencode(text_v_url)
Volume <- read_csv(v_url)
# Clean and filter
Volume$Date <- as.Date(Volume$Date, "%Y-%m-%d")
Volume <- Volume %>% filter(Series == "Article Count")
VolumeB <- Volume # Swift data
# -----------------------------
# Merge datasets
# -----------------------------
VolumeAB <- merge(VolumeA, VolumeB, by = "Date")
VolumeAB$VolumeA <- VolumeAB$Value.x
VolumeAB$VolumeB <- VolumeAB$Value.y
# -----------------------------
# Create interactive plot
# -----------------------------
fig <- plot_ly(
data = VolumeAB,
x = ~Date,
y = ~VolumeA,
name = 'Trump',
type = 'scatter',
mode = 'lines',
line = list(color = "#AE2012")
) %>%
add_trace(
y = ~VolumeB,
name = 'Taylor Swift',
mode = 'lines',
line = list(color = "#005F73")
) %>%
layout(
title = 'U.S. coverage volume: Trump vs Taylor Swift',
xaxis = list(title = "Date", showgrid = FALSE),
yaxis = list(title = "Volume", showgrid = TRUE)
)
# Display the plot
fig
# -----------------------------
# Save merged data to CSV
# -----------------------------
write_csv(VolumeAB, "VolumeAB.csv")