http://rpubs.com/umais/data607_week9_assignment
https://github.com/umais/DATA-607/tree/master/Week9_Assignment
Using the jsonLite library we will be reading the JSON document from the New your times API. Once document is read we will transform the json in to a R data frame object
After retrieving the API Key Making a call to the Ny Times Article search API to get the listing of the articles
library(jsonlite)
nytimes_articles <- fromJSON("http://developer.nytimes.com/proxy/https/api.nytimes.com/svc/search/v2/articlesearch.json?api-key=d0aaa22b5c5e46dea282c685d7ecfb07")
In this step we successfully created a data frame from the JSON returned from the API call
articleDf=data.frame(nytimes_articles$response$docs$pub_date)
colnames(articleDf)<-c('publishdate')
articleDf$type=nytimes_articles$response$docs$document_type
articleDf$headline=nytimes_articles$response$docs$headline$main
articleDf$source=nytimes_articles$response$docs$source
articleDf$section_name=nytimes_articles$response$docs$section_name
articleDf$web_url=nytimes_articles$response$docs$web_url
articleDf
## publishdate type
## 1 2017-10-29T23:42:37+0000 article
## 2 2017-10-29T23:42:33+0000 article
## 3 2017-10-29T23:38:43+0000 article
## 4 2017-10-29T23:36:08+0000 article
## 5 2017-10-29T23:30:37+0000 article
## 6 2017-10-29T23:24:28+0000 article
## 7 2017-10-29T23:15:27+0000 article
## 8 2017-10-29T23:09:33+0000 article
## 9 2017-10-29T23:06:40+0000 article
## 10 2017-10-29T23:06:28+0000 article
## headline
## 1 Cowboys 'Feed Zeke,' Capitalize on Mistakes to Beat Redskins
## 2 10 Things to Know for Monday
## 3 Manhattan Gallery<U+0092>s Squeaky Floor Draws the Wrath of Rodent Lovers
## 4 In Third Retirement, Martina Hingis Cedes Her Doubles Kingdom
## 5 Oladipo's Late 3 Gives Pacers Rare 97-94 Win Over Spurs
## 6 Flood of Chinese Capital Seen Shaking Up Aviation Finance
## 7 As China's Home Prices Cool, Some Property Companies Seek to Reduce Risks
## 8 Special Counsel's Russia Probe Entering New Phase With First Charges
## 9 Los Angeles Mayor Eric Garcetti Says No to Run for Governor
## 10 Qatar Emir Says Open to Trump-Hosted Talks Over Gulf Crisis: CBS
## source section_name
## 1 AP Pro Football
## 2 AP <NA>
## 3 The New York Times <NA>
## 4 The New York Times Tennis
## 5 AP Pro Basketball
## 6 Reuters <NA>
## 7 Reuters <NA>
## 8 Reuters Europe
## 9 AP <NA>
## 10 Reuters Middle East
## web_url
## 1 https://www.nytimes.com/aponline/2017/10/29/sports/football/ap-fbn-cowboys-redskins.html
## 2 https://www.nytimes.com/aponline/2017/10/29/us/ap-10-things-to-know-monday.html
## 3 https://www.nytimes.com/2017/10/29/nyregion/mouse-floor-art-installation.html
## 4 https://www.nytimes.com/2017/10/29/sports/tennis/martina-hingis-retire.html
## 5 https://www.nytimes.com/aponline/2017/10/29/sports/basketball/ap-bkn-spurs-pacers.html
## 6 https://www.nytimes.com/reuters/2017/10/29/business/29reuters-aviation-finance.html
## 7 https://www.nytimes.com/reuters/2017/10/29/business/29reuters-china-property-debt-analysis.html
## 8 https://www.nytimes.com/reuters/2017/10/29/world/europe/29reuters-usa-trump-russia.html
## 9 https://www.nytimes.com/aponline/2017/10/29/us/ap-us-los-angeles-mayor.html
## 10 https://www.nytimes.com/reuters/2017/10/29/world/middleeast/29reuters-gulf-crisis-qatar.html