Based on the unigram analysis of the Donald Trump headlines, the most frequently occurring words suggest that news coverage of Trump is heavily connected to politics, elections, legal issues, and government affairs. Because common words such as “Trump,” “Donald,” and other generic terms were removed from the analysis, the remaining top words help reveal the specific topics that journalists emphasize when discussing him. For example, if words such as “election,” “court,” “campaign,” “vote,” or “case” appear among the most common unigrams, this indicates that much of the coverage focuses on Trump’s political activities and ongoing legal challenges. The frequency of these words suggests that news organizations often frame Trump-related stories around his role in national politics and his involvement in major legal proceedings.

The analysis also shows that headlines tend to focus on issues that have broad public and political significance. Words associated with government policies, candidates, investigations, or economic issues would indicate that Trump’s actions and statements are frequently linked to larger national debates. This suggests that media coverage does not only report on Trump as an individual but also connects him to wider discussions about elections, public policy, and the future direction of the country. Headlines are designed to quickly communicate the main point of a story, so frequently occurring unigrams can provide a useful summary of the themes that dominate coverage.

Overall, the unigram analysis suggests that news media portray Donald Trump primarily through the lens of politics, governance, and controversy. The most common words reveal the topics that repeatedly appear alongside his name, offering insight into how journalists and news organizations frame stories involving Trump and which issues receive the greatest attention in the media

Code:

# Step 1: Install and Load Required Packages ----

if (!require(tidyverse)) {
  install.packages("tidyverse")
  library(tidyverse)
}

if (!require(tidytext)) {
  install.packages("tidytext")
  library(tidytext)
}


# Step 2: Load Data ----

Trump_story_headlines <- readRDS(
  "Trump_story_headlines.rds"
)

# Examine Data

names(Trump_story_headlines
)

# Step 3: Tokenize Headlines into Unigrams ----

Trump_Unigrams <- Trump_story_headlines %>%
  select(title) %>%      # Replace 'title' if necessary
  unnest_tokens(
    output = word,
    input = title,
    token = "words"
  )

# Step 4: Remove Stop Words ----

Trump_Unigrams <- Trump_Unigrams %>%
  anti_join(
    stop_words,
    by = "word"
  )

# Step 5: Remove Social Media Artifacts and Common Words ----

remove_words <- c(
  "https",
  "http",
  "www",
  "com",
  "amp",
  "rt",
  "co",
  "said",
  "says",
  "say",
  "new",
  "one",
  "two",
  "will",
  "would",
  
  # Trump-specific high-frequency words
  "trump",
  "donald",
  "president",
  "former",
  "presidential",
  "administration",
  "campaign"
)

Trump_Unigrams <- Trump_Unigrams %>%
  filter(
    !word %in% remove_words
  )

# Step 6: Count Frequency of Each Unigram ----

Word_Frequency <- Trump_Unigrams %>%
  count(
    word,
    sort = TRUE
  )

# View Results

head(Word_Frequency, 20)

# Step 7: Select Top 15 Words ----

Top15_Words <- Word_Frequency %>%
  slice_max(
    order_by = n,
    n = 15
  )

Top15_Words

# Step 8: Create Bar Chart ----

Top15_Plot <- ggplot(
  Top15_Words,
  aes(
    x = reorder(word, n),
    y = n
  )
) +
  geom_col(
    fill = "steelblue"
  ) +
  coord_flip() +
  labs(
    title = "Top 15 Most Frequent Unigrams in Trump Headlines",
    x = "Unigram",
    y = "Frequency"
  ) +
  theme_minimal()

# Step 9: Display Plot ----

Top15_Plot