Introduction

I chose to search the New York Times Article Search API for mentions of the word secession between December 1, 1860 and December 7, 1860.

Load Libraries

suppressWarnings(suppressMessages(library(httr)))
suppressWarnings(suppressMessages(library(RCurl)))
suppressWarnings(suppressMessages(library(tidyr)))
suppressWarnings(suppressMessages(library(dplyr)))
suppressWarnings(suppressMessages(library(rtimes)))
suppressWarnings(suppressMessages(library(readr)))

Reading in the API Key. It is stored in a file on my computer so that it remains secure.

NYTIMES_AS_KEY = read_file("C:/Users/Swigo/OneDrive/Documents/GitHub/DATA-607/nytimesapi.txt")

Searching the New York Times Article Search API

Searching for the word secession between the dates of 12/1/1860 and 12/7/1860
secession_search <- as_search(q="secession", begin_date = "18601201", end_date = "18601207", key=NYTIMES_AS_KEY)

Selecting the Publication Date, Type of Article, Headline, Web URL

nytimes_secession <- select(secession_search$data, 7, 9, 13, 1)

Converting the Tibble into a Dataframe

nytimesdf <- data.frame(nytimes_secession)
nytimesdf
##                pub_date type_of_material
## 1  1860-12-06T00:03:58Z        Editorial
## 2  1860-12-06T00:03:58Z          Article
## 3  1860-12-06T00:03:58Z       Front Page
## 4  1860-12-06T00:03:58Z          Article
## 5  1860-12-06T00:03:58Z       Front Page
## 6  1860-12-06T00:03:58Z       Front Page
## 7  1860-12-06T00:03:58Z       Front Page
## 8  1860-12-06T00:03:58Z       Front Page
## 9  1860-12-06T00:03:58Z        Editorial
## 10 1860-12-05T00:03:58Z        Editorial
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                           headline.main
## 1                                                                                                                                                                                                                                                                                                                                                                                                                                                                      NEWS OF THE DAY.
## 2                                                                                                                                                                                                                                                                                                           LATER FROM THE PACIFIC.; Arrival of the Overland Express--Reception of the Secession News in California--Great Riot between Negroes and Whites in the Victoria Theatre, &c.
## 3                                                                                                                                                                                                                                                                                                                                                                                                                                  IN LOUISIANA.; RECEPTION OF THE PRESIDENT'S MESSAGE.
## 4                                                                                                                                                                                                                                                                                                                                                                                                                                   SOUTH CAROLINA AFRAID OF DELAY--FRANK; CONFESSIONS.
## 5                                                                                                                                                                                                                                                                                                                                                                                     IN VIRGINIA.; THE ELECTORAL VOTE CAST FOR BELL--THE ENGLISH AND SECESSION--LETTER FROM MR. BOTTS.
## 6                                                                                                                                                                                                                                                                                                                                                                                                                                                   CONGRESSIONAL PROCEEDINGS.; SENATE.
## 7                                                                                                                                                                                                                                                                                                                                                      THE SECESSION MOVEMENT.; IN SOUTH CAROLINA. THE LEGISLATURE--PASSAGE OF THE BILL TO ARM THE STATE--RECEPTION OF THE MESSAGE, &C.
## 8  THE NATIONAL CRISIS.; Highly Important from the Federal Capital. Discussion of the the Disunion Question in the Senate. Senator Hale's Views on the President's Message and Secession. Violent Harangue of Senator Iverson, of Georgia. Strong Union Speech of Senator Saulsbury, of Delaware. Passage of the Homestead Bill, the Pension Bill, and the West Point Bill in the House. THE LATEST REPORTS FROM THE SOUTH. Important Action of the Governors of Virginia and Kentucky.
## 9                                                                                                                                                                                                                                                                                                                                                                                                                                                                One-Sided Compromises.
## 10                                                                                                                                                                                                                                                                                                                                                                                                                                                                     NEWS OF THE DAY.
##                                                                                                                          web_url
## 1                                                                   https://www.nytimes.com/1860/12/06/news/news-of-the-day.html
## 2  https://www.nytimes.com/1860/12/06/news/later-pacific-arrival-overland-express-reception-secession-california-great-riot.html
## 3                                 https://www.nytimes.com/1860/12/06/news/in-louisiana-reception-of-the-president-s-message.html
## 4                                  https://www.nytimes.com/1860/12/06/news/south-carolina-afraid-of-delay-frank-confessions.html
## 5           https://www.nytimes.com/1860/12/06/news/virginia-electoral-vote-cast-for-bell-english-secession-letter-mr-botts.html
## 6                                                  https://www.nytimes.com/1860/12/06/news/congressional-proceedings-senate.html
## 7    https://www.nytimes.com/1860/12/06/news/secession-movement-south-carolina-legislature-passage-bill-arm-state-reception.html
## 8     https://www.nytimes.com/1860/12/06/news/national-crisis-highly-important-federal-capital-discussion-disunion-question.html
## 9                                                             https://www.nytimes.com/1860/12/06/news/one-sided-compromises.html
## 10                                                                  https://www.nytimes.com/1860/12/05/news/news-of-the-day.html