What's News?

newsflash package

Polymath, Bob Rudis (aka hrbrmstr) has recently released the newsflash package which is a “set of tools to Work with the Internet Archive and GDELT Television Explorer”"

In a recent blog post, based on a gdelt project creator article, he details the coverage of Hillary Clinton’s email server woes, with the, unsurprising, fact that FOX News spent more time on the issue than other broadcasters


I will take a slightly different tack by, firstly, looking at some of the major news stories of March in the USA

We just need to load a few packages

library(newsflash)
library(plotly)
library(tidyverse)

Let’s just look at four issues that have impinged on President Trump recently

  • His Tax Returns
  • The Travel Ban
  • The New Healthcare Bill
  • Wire Tapping Claims

query_tv() is the function that does most of the work. In it, you enter primary_keyword e.g ‘Trump’ and then context_keywords which are words that appear within four sentences of mention of the keyword. This is obviously a bit hit and miss and limited to 50 characters in length before throwing an error. For the tax returns I chose these words: tax,returns, leak,income,bill. Feel free to amend in adapting the code

There is a maximum of 2,500 results per query. Bob’s code explains how to manouvre around this. However, as I am just looking at a seven day period - which also supplies results in 30 minute chunks - for just the National Networks that does not pose an issue. We do, however, need to ensure the correct time span an use the list_networks() function for this

# list networks available and date range of information
list_networks() %>% 
  as.tbl() %>% 
  select(-keyword) %>% 
  head(10)
## # A tibble: 56 x 3
##                       keyword                             network
##                         <chr>                               <chr>
##  1                   NATIONAL               All National Networks
##  2                  BLOOMBERG                           Bloomberg
##  3                       CNBC                                CNBC
##  4                        CNN                                 CNN
##  5                        FBC                        FOX Business
##  6                   FOXNEWSW                            FOX News
##  7                      MSNBC                               MSNBC
##  8              INTERNATIONAL          All International Networks
##  9                 BBCNEWSSEG                            BBC News
## 10       NATIONALDISCONTINUED  All Discontinued National Networks
## 11                    ALJAZAM                   Aljazeera America
## 12                        ALL           All Combined All Networks
## 13                        ALL                                <NA>
## 14                  AFFNETALL              All Affiliate Networks
## 15                 AFFNET_ABC              ABC Affiliate Stations
## 16                 AFFNET_CBS              CBS Affiliate Stations
## 17                 AFFNET_FOX              FOX Affiliate Stations
## 18                AFFNET_MYTV             MYTV Affiliate Stations
## 19                 AFFNET_NBC              NBC Affiliate Stations
## 20                 AFFNET_PBS              PBS Affiliate Stations
## 21                 AFFMARKALL               All Affiliate Markets
## 22           AFFMARKET_Boston           Boston Affiliate Stations
## 23     AFFMARKET_Cedar Rapids     Cedar Rapids Affiliate Stations
## 24        AFFMARKET_Charlotte        Charlotte Affiliate Stations
## 25       AFFMARKET_Cincinnati       Cincinnati Affiliate Stations
## 26        AFFMARKET_Cleveland        Cleveland Affiliate Stations
## 27 AFFMARKET_Colorado Springs Colorado Springs Affiliate Stations
## 28         AFFMARKET_Columbia         Columbia Affiliate Stations
## 29  AFFMARKET_Dakota Dunes SD  Dakota Dunes SD Affiliate Stations
## 30    AF