The New York Times web site provides a rich set of APIs, as described here: http://developer.nytimes.com/docs
You’ll need to start by signing up for an API key. Your task is to choose one of the New York Times APIs, construct an interface in R to read in the JSON data, and transform it to an R dataframe.
I decided to work with The Article Search API and to construct a function like the example in our text, chapter 9, using Yahoo weather data.
With the Article Search API (v2), you can search New York Times articles from Sept. 18, 1851 to today, retrieving headlines, abstracts, lead paragraphs, links to associated multimedia and other article metadata.
Base URI: http://api.nytimes.com/svc/search/v2/articlesearch
HTTP method: GET
Response formats: JSON (.json), JSONP (.jsonp)
There are 12 possible parameters for search, not counting the API key, and at least one of the parameters has 17 possible values. I decide to make my R wrapper function very simple for my version 1 and use 2 parameters, topic (search phrase) and response (most recent hits = new, oldest hits = old, blank = highest relevance).
Here I load the needed R Libraries and start building the parts of my search URL. I decide to put my API Key here in the code, so the code will run from GitHub and RPubs. I learned how to use the R Options method for saving ID’s outside of my code from the Yahoo example.
library(jsonlite)
##
## Attaching package: 'jsonlite'
##
## The following object is masked from 'package:utils':
##
## View
library(dplyr)
##
## Attaching package: 'dplyr'
##
## The following objects are masked from 'package:stats':
##
## filter, lag
##
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
topic = "application programming interfaces"
# Put topic in API format
topic <- gsub(" ", "+", topic)
# Get most recent articles
searchurl <- "http://api.nytimes.com/svc/search/v2/articlesearch.json?q=%s&sort=newest&api-key=91d71cc6a4bdd339cb45f37747025836:18:62602330"
searchurl <- sprintf(searchurl, topic)
# Test search API
test <- fromJSON(searchurl)
test
## $response
## $response$meta
## $response$meta$hits
## [1] 62
##
## $response$meta$time
## [1] 95
##
## $response$meta$offset
## [1] 0
##
##
## $response$docs
## web_url
## 1 http://bits.blogs.nytimes.com/2015/06/29/supreme-court-declines-to-hear-appeal-in-google-oracle-copyright-fight/
## 2 http://www.nytimes.com/reuters/2014/10/08/technology/08reuters-google-oracle-lawsuit.html
## 3 http://www.nytimes.com/2014/08/28/nyregion/students-inventing-programs-to-streamline-their-colleges-data.html
## 4 http://bits.blogs.nytimes.com/2014/05/29/samsung-stakes-claim-on-wearable-tech-that-monitors-health/
## 5 http://www.nytimes.com/reuters/2014/05/09/business/09reuters-oracle-google-ruling.html
## 6 http://www.nytimes.com/2014/03/16/magazine/silicon-valleys-youth-problem.html
## 7 http://www.nytimes.com/2013/12/15/magazine/googles-plan-for-global-domination-dont-ask-why-ask-where.html
## 8 http://www.nytimes.com/2013/11/11/technology/to-grow-twitter-looks-to-wider-web-and-outside-developers.html
## 9 http://wheels.blogs.nytimes.com/2013/02/25/with-its-eye-on-infotainment-general-motors-is-upgrading-onstar/
## 10 http://bits.blogs.nytimes.com/2013/01/11/c-e-s-2013-the-voice-controlled-home-with-a-catch/
## snippet
## 1 A years-long copyright fight between Google and Oracle will continue. At issue are the bits of code that help pieces of software work together, called Application Programming Interfaces.
## 2 Google Inc has asked the U.S. Supreme Court to wade into contentious litigation against Oracle Corp, arguing that the high court must act to protect innovation in high tech.
## 3 Undergraduates are building apps that are faster, easier-to-navigate versions of campus systems such as the ones that manage course catalogs and class scheduling.
## 4 Samsung announced plans for a platform to allow developers, medical professionals and hardware makers push forward the idea of <U+0093>intelligent digital health.<U+0094>
## 5 Oracle Corp won a legal victory against Google Inc on Friday as a U.S. appeals court decided Oracle could copyright parts of the Java programming language, which Google used to design its Android smartphone operating system.
## 6 In start-up land, the young barely talk to the old (and vice versa). That makes for a lot of cool apps. But great technology? Not so much.
## 7 In the battle for digital dominance, victory depends on being the first to map every last place on the globe. It<U+0092>s as hard as it sounds.
## 8 Twitter is counting on millions of websites to link to the service and is encouraging independent developers to find creative new uses for its platform.
## 9 G.M. said it would provide 4G LTE mobile broadband connectivity in certain 2015 Chevrolet, Buick, GMC and Cadillac models.
## 10 An alarm clock is designed to be the voice-control system for other gadgets, but it is hamstrung by the company's inability to convince other manufacturers that it makes sense to work together.
## lead_paragraph
## 1 <NA>
## 2 Google Inc has asked the U.S. Supreme Court to wade into contentious litigation against Oracle Corp, arguing that the high court must act to protect innovation in high tech.
## 3 Undergraduates are building apps that are faster, easier-to-navigate versions of campus systems such as the ones that manage course catalogs and class scheduling.
## 4 <NA>
## 5 Oracle Corp won a legal victory against Google Inc on Friday as a U.S. appeals court decided Oracle could copyright parts of the Java programming language, which Google used to design its Android smartphone operating system.
## 6 In start-up land, the young barely talk to the old (and vice versa). That makes for a lot of cool apps. But great technology? Not so much.
## 7 In the battle for digital dominance, victory depends on being the first to map every last place on the globe. It<U+0092>s as hard as it sounds.
## 8 Twitter is counting on millions of websites to link to the service and is encouraging independent developers to find creative new uses for its platform.
## 9 <NA>
## 10 <NA>
## abstract
## 1 A years-long copyright fight between Google and Oracle will continue. At issue are the bits of code that help pieces of software work together, called Application Programming Interfaces.
## 2 <NA>
## 3 College students across the country are building faster, more informative and overall better versions of universities' information systems managing course selection and scheduling; this culture of innovation has accelerated debates about the flow of information on campus, and forced colleges to reckon with some unexpected results of the programming skills they are imparting.
## 4 Samsung announced plans for a platform to allow developers, medical professionals and hardware makers push forward the idea of <U+0093>intelligent digital health.<U+0094>
## 5 <NA>
## 6 Yiren Lu article examines the divide between generations in Silicon Valley and the dysfunction it creates; suggests chasm is leading to a dearth of the kind of fundamental technologies that paved the way for many of the innovative applications and enterprises available today.
## 7 Adam Fisher article on Google's plan for digital domination, which depends on being the first Internet company to map every last place on the globe.
## 8 Twitter, in effort to justify high valuation of its stock, is counting on millions of Web sites to link to its service and is encouraging independent developers to find creative new uses for its platform; start-ups like Gozaik, Tame and Nuzzel, are trying to build on Twitter's design, using it for springboard for their own companies.
## 9 G.M. said it would provide 4G LTE mobile broadband connectivity in certain 2015 Chevrolet, Buick, GMC and Cadillac models.
## 10 An alarm clock is designed to be the voice-control system for other gadgets, but it is hamstrung by the company's inability to convince other manufacturers that it makes sense to work together.
## print_page blog source
## 1 <NA> NULL The New York Times
## 2 <NA> NULL Reuters
## 3 1 NULL The New York Times
## 4 <NA> NULL The New York Times
## 5 <NA> NULL Reuters
## 6 28 NULL The New York Times
## 7 42 NULL The New York Times
## 8 3 NULL
## 9 <NA> NULL The New York Times
## 10 <NA> NULL The New York Times
## multimedia
## 1 190, 600, 75, images/2015/06/30/business/30oracle-web/30oracle-web-thumbWide.jpg, images/2015/06/30/business/30oracle-web/30oracle-web-articleLarge.jpg, images/2015/06/30/business/30oracle-web/30oracle-web-thumbStandard.jpg, 126, 404, 75, wide, xlarge, thumbnail, images/2015/06/30/business/30oracle-web/30oracle-web-thumbWide.jpg, NA, NA, 126, NA, NA, 190, NA, NA, NA, 600, NA, NA, images/2015/06/30/business/30oracle-web/30oracle-web-articleLarge.jpg, NA, NA, 404, NA, NA, NA, 75, NA, NA, images/2015/06/30/business/30oracle-web/30oracle-web-thumbStandard.jpg, NA, NA, 75, image, image, image
## 2 NULL
## 3 190, 600, 75, images/2014/08/28/nyregion/y-jpCOURSES1/y-jpCOURSES1-thumbWide.jpg, images/2014/08/28/nyregion/y-jpCOURSES1/y-jpCOURSES1-articleLarge.jpg, images/2014/08/28/nyregion/y-jpCOURSES1/y-jpCOURSES1-thumbStandard.jpg, 126, 400, 75, wide, xlarge, thumbnail, images/2014/08/28/nyregion/y-jpCOURSES1/y-jpCOURSES1-thumbWide.jpg, NA, NA, 126, NA, NA, 190, NA, NA, NA, 600, NA, NA, images/2014/08/28/nyregion/y-jpCOURSES1/y-jpCOURSES1-articleLarge.jpg, NA, NA, 400, NA, NA, NA, 75, NA, NA, images/2014/08/28/nyregion/y-jpCOURSES1/y-jpCOURSES1-thumbStandard.jpg, NA, NA, 75, image, image, image
## 4 190, 600, 75, images/2014/05/28/business/28SamsungHealth/28SamsungHealth-thumbWide.jpg, images/2014/05/28/business/28SamsungHealth/28SamsungHealth-articleLarge.jpg, images/2014/05/28/business/28SamsungHealth/28SamsungHealth-thumbStandard.jpg, 126, 354, 75, wide, xlarge, thumbnail, images/2014/05/28/business/28SamsungHealth/28SamsungHealth-thumbWide.jpg, NA, NA, 126, NA, NA, 190, NA, NA, NA, 600, NA, NA, images/2014/05/28/business/28SamsungHealth/28SamsungHealth-articleLarge.jpg, NA, NA, 354, NA, NA, NA, 75, NA, NA, images/2014/05/28/business/28SamsungHealth/28SamsungHealth-thumbStandard.jpg, NA, NA, 75, image, image, image
## 5 NULL
## 6 wide, xlarge, thumbnail, images/2014/03/10/magazine/mag-16Silicon/mag-16Silicon-thumbWide-v4.png, images/2014/03/10/magazine/mag-16Silicon/mag-16Silicon-articleLarge-v4.png, images/2014/03/10/magazine/mag-16Silicon/mag-16Silicon-thumbStandard-v4.jpg, 126, 337, 75, 190, 600, 75, images/2014/03/10/magazine/mag-16Silicon/mag-16Silicon-thumbWide-v4.png, NA, NA, 126, NA, NA, 190, NA, NA, NA, 600, NA, NA, images/2014/03/10/magazine/mag-16Silicon/mag-16Silicon-articleLarge-v4.png, NA, NA, 337, NA, NA, NA, 75, NA, NA, images/2014/03/10/magazine/mag-16Silicon/mag-16Silicon-thumbStandard-v4.jpg, NA, NA, 75, image, image, image
## 7 wide, xlarge, thumbnail, images/2013/12/15/magazine/mag-15Google-t_CA2/mag-15Google-t_CA2-thumbWide-v4.png, images/2013/12/15/magazine/mag-15Google-t_CA2/mag-15Google-t_CA2-articleLarge-v4.png, images/2013/12/11/magazine/11-google-maps/11-google-maps-thumbStandard.jpg, 126, 598, 75, 190, 600, 75, images/2013/12/15/magazine/mag-15Google-t_CA2/mag-15Google-t_CA2-thumbWide-v4.png, NA, NA, 126, NA, NA, 190, NA, NA, NA, 600, NA, NA, images/2013/12/15/magazine/mag-15Google-t_CA2/mag-15Google-t_CA2-articleLarge-v4.png, NA, NA, 598, NA, NA, NA, 75, NA, NA, images/2013/12/11/magazine/11-google-maps/11-google-maps-thumbStandard.jpg, NA, NA, 75, image, image, image
## 8 190, 600, 75, images/2013/11/11/business/platform/platform-thumbWide.jpg, images/2013/11/11/business/platform/platform-articleLarge.jpg, images/2013/11/11/business/platform/platform-thumbStandard-v2.jpg, 126, 400, 75, wide, xlarge, thumbnail, images/2013/11/11/business/platform/platform-thumbWide.jpg, NA, NA, 126, NA, NA, 190, NA, NA, NA, 600, NA, NA, images/2013/11/11/business/platform/platform-articleLarge.jpg, NA, NA, 400, NA, NA, NA, 75, NA, NA, images/2013/11/11/business/platform/platform-thumbStandard-v2.jpg, NA, NA, 75, image, image, image
## 9 NULL
## 10 190, 600, 75, images/2013/01/10/technology/10bits-ivee/10bits-ivee-thumbWide.jpg, images/2013/01/10/technology/10bits-ivee/10bits-ivee-articleLarge.jpg, images/2013/01/10/technology/10bits-ivee/10bits-ivee-thumbStandard.jpg, 126, 437, 75, wide, xlarge, thumbnail, images/2013/01/10/technology/10bits-ivee/10bits-ivee-thumbWide.jpg, NA, NA, 126, NA, NA, 190, NA, NA, NA, 600, NA, NA, images/2013/01/10/technology/10bits-ivee/10bits-ivee-articleLarge.jpg, NA, NA, 437, NA, NA, NA, 75, NA, NA, images/2013/01/10/technology/10bits-ivee/10bits-ivee-thumbStandard.jpg, NA, NA, 75, image, image, image
## headline.main
## 1 Supreme Court Declines to Hear Appeal in Google-Oracle Copyright Fight
## 2 Google Asks Supreme Court to Decide Oracle Copyright Fight
## 3 Student-Built Apps Teach Colleges a Thing or Two
## 4 Samsung Stakes Claim on Wearable Tech That Monitors Health
## 5 Oracle Wins Copyright Ruling Against Google Over Android
## 6 Silicon Valley<U+0092>s Youth Problem
## 7 Google<U+0092>s Road Map to Global Domination
## 8 To Grow, Twitter Looks Outside Its Own Walls
## 9 With Its Eye on Infotainment, General Motors Is Upgrading OnStar
## 10 C.E.S. 2013: The Voice-Controlled Home, With a Catch
## headline.kicker
## 1 Bits
## 2 <NA>
## 3 <NA>
## 4 Bits
## 5 <NA>
## 6 <NA>
## 7 <NA>
## 8 <NA>
## 9 Wheels
## 10 Bits
## headline.print_headline
## 1 Supreme Court Declines to Hear Google-Oracle Appeal
## 2 Google Asks Supreme Court to Decide Oracle Copyright Fight
## 3 Students<U+0092> Apps Teach Colleges a Thing or Two
## 4 <NA>
## 5 Oracle Wins Copyright Ruling Against Google Over Android
## 6 A Tale of Two Valleys
## 7 Don't Ask Why. Ask Where.
## 8 To Grow, Twitter Looks Outside Its Own Walls
## 9 <NA>
## 10 <NA>
## keywords
## 1 1, 2, 3, 1, 2, organizations, organizations, organizations, subject, subject, Google Inc, Oracle Corporation, Supreme Court (US), Android (Operating System), Copyrights and Copyright Violations
## 2 NULL
## 3 1, 2, 3, Y, Y, N, Colleges and Universities, Computers and the Internet, Software, subject, subject, subject
## 4 2, 1, 2, 1, 3, 2, 5, 4, 1, glocations, glocations, organizations, organizations, subject, subject, subject, subject, subject, United States, San Francisco (Calif), Samsung Group, Apple Inc, Mobile Applications, Exercise, Wearable Computing, New Models, Design and Products, Data Storage
## 5 NULL
## 6 Silicon Valley (Calif), Computers and the Internet, Engineering and Engineers, Start-ups, Labor and Jobs, Software, Meraki Inc, Biswas, Sanjit, Stripe Inc, N, Y, N, N, N, N, N, N, N, 1, 2, 3, 4, 5, 6, 7, 8, 9, glocations, subject, subject, subject, subject, subject, organizations, persons, organizations
## 7 Google Street View, Vincent, Luc, Maps, Computers and the Internet, Google Maps, Google Inc, N, N, Y, N, N, Y, 5, 1, 3, 4, 2, 6, organizations, persons, subject, subject, organizations, organizations
## 8 3, 1, 2, 4, N, Y, Y, N, Start-ups, Twitter, Social Media, Online Advertising, subject, organizations, subject, subject
## 9 1, 2, 3, 4, 5, 6, 1, 2, organizations, organizations, organizations, organizations, organizations, organizations, subject, subject, AT&T Inc, Buick Division of General Motors Corp, Cadillac Division of General Motors Corp, Chevrolet Division of General Motors Corp, General Motors, OnStar Corp, Automobiles, Wireless Communications
## 10 NULL
## pub_date document_type news_desk section_name
## 1 2015-06-29T19:46:39Z blogpost Business Technology
## 2 2014-10-08T17:53:36Z article None Technology
## 3 2014-08-28T00:00:00Z article Metro N.Y. / Region
## 4 2014-05-29T00:29:06Z blogpost Business Technology
## 5 2014-05-09T11:31:32Z article <NA> Business Day
## 6 2014-03-16T00:00:00Z article Magazine Magazine
## 7 2013-12-15T00:00:00Z article Magazine Magazine
## 8 2013-11-11T00:00:00Z article Business Technology
## 9 2013-02-25T16:57:05Z blogpost <NA> Autos
## 10 2013-01-11T13:00:37Z blogpost <NA> Technology
## subsection_name byline.person byline.original
## 1 NA , reported, Quentin, 1, HARDY By QUENTIN HARDY
## 2 NA NULL By REUTERS
## 3 NA , reported, Ariel, 1, KAMINER By ARIEL KAMINER
## 4 NA , reported, Molly, 1, WOOD By MOLLY WOOD
## 5 NA NULL By REUTERS
## 6 NA , reported, 1, Yiren, LU By YIREN LU
## 7 NA , reported, 1, Adam, FISHER By ADAM FISHER
## 8 NA , reported, Vindu, 1, GOEL By VINDU GOEL
## 9 NA , reported, Paul, 1, STENQUIST By PAUL STENQUIST
## 10 NA , reported, Roy, 1, FURCHGOTT By ROY FURCHGOTT
## byline.organization byline.contributor type_of_material
## 1 <NA> <NA> Blog
## 2 REUTERS <NA> News
## 3 <NA> News
## 4 <NA> <NA> Blog
## 5 REUTERS <NA> News
## 6 <NA> News
## 7 <NA> News
## 8 <NA> News
## 9 <NA> <NA> Blog
## 10 <NA> <NA> Blog
## _id word_count slideshow_credits
## 1 5591d941798810525124d243 639 NA
## 2 5435b2c6798810520e354b4e 259 NA
## 3 53fe859d7988106d48b1fc71 1332 NA
## 4 5386b7f07988101cbeba0057 816 NA
## 5 536cf5c6798810204eca399b 603 NA
## 6 5320221d79881012a4bf00c8 7066 NA
## 7 52a898c87988101877eca560 5942 NA
## 8 5280046a7988104c937f5ae8 1101 NA
## 9 512bf24acf28d009de001f7c 420 NA
## 10 50f054b100315214fbb83bc2 297 NA
##
##
## $status
## [1] "OK"
##
## $copyright
## [1] "Copyright (c) 2013 The New York Times Company. All Rights Reserved."
str(test)
## List of 3
## $ response :List of 2
## ..$ meta:List of 3
## .. ..$ hits : int 62
## .. ..$ time : int 95
## .. ..$ offset: int 0
## ..$ docs:'data.frame': 10 obs. of 20 variables:
## .. ..$ web_url : chr [1:10] "http://bits.blogs.nytimes.com/2015/06/29/supreme-court-declines-to-hear-appeal-in-google-oracle-copyright-fight/" "http://www.nytimes.com/reuters/2014/10/08/technology/08reuters-google-oracle-lawsuit.html" "http://www.nytimes.com/2014/08/28/nyregion/students-inventing-programs-to-streamline-their-colleges-data.html" "http://bits.blogs.nytimes.com/2014/05/29/samsung-stakes-claim-on-wearable-tech-that-monitors-health/" ...
## .. ..$ snippet : chr [1:10] "A years-long copyright fight between Google and Oracle will continue. At issue are the bits of code that help pieces of softwar"| __truncated__ "Google Inc has asked the U.S. Supreme Court to wade into contentious litigation against Oracle Corp, arguing that the high cour"| __truncated__ "Undergraduates are building apps that are faster, easier-to-navigate versions of campus systems such as the ones that manage co"| __truncated__ "Samsung announced plans for a platform to allow developers, medical professionals and hardware makers push forward the idea of "| __truncated__ ...
## .. ..$ lead_paragraph : chr [1:10] NA "Google Inc has asked the U.S. Supreme Court to wade into contentious litigation against Oracle Corp, arguing that the high cour"| __truncated__ "Undergraduates are building apps that are faster, easier-to-navigate versions of campus systems such as the ones that manage co"| __truncated__ NA ...
## .. ..$ abstract : chr [1:10] "A years-long copyright fight between Google and Oracle will continue. At issue are the bits of code that help pieces of softwar"| __truncated__ NA "College students across the country are building faster, more informative and overall better versions of universities' informat"| __truncated__ "Samsung announced plans for a platform to allow developers, medical professionals and hardware makers push forward the idea of "| __truncated__ ...
## .. ..$ print_page : chr [1:10] NA NA "1" NA ...
## .. ..$ blog :List of 10
## .. .. ..$ : list()
## .. .. ..$ : list()
## .. .. ..$ : list()
## .. .. ..$ : list()
## .. .. ..$ : list()
## .. .. ..$ : list()
## .. .. ..$ : list()
## .. .. ..$ : list()
## .. .. ..$ : list()
## .. .. ..$ : list()
## .. ..$ source : chr [1:10] "The New York Times" "Reuters" "The New York Times" "The New York Times" ...
## .. ..$ multimedia :List of 10
## .. .. ..$ :'data.frame': 3 obs. of 6 variables:
## .. .. .. ..$ width : int [1:3] 190 600 75
## .. .. .. ..$ url : chr [1:3] "images/2015/06/30/business/30oracle-web/30oracle-web-thumbWide.jpg" "images/2015/06/30/business/30oracle-web/30oracle-web-articleLarge.jpg" "images/2015/06/30/business/30oracle-web/30oracle-web-thumbStandard.jpg"
## .. .. .. ..$ height : int [1:3] 126 404 75
## .. .. .. ..$ subtype: chr [1:3] "wide" "xlarge" "thumbnail"
## .. .. .. ..$ legacy :'data.frame': 3 obs. of 9 variables:
## .. .. .. .. ..$ wide : chr [1:3] "images/2015/06/30/business/30oracle-web/30oracle-web-thumbWide.jpg" NA NA
## .. .. .. .. ..$ wideheight : chr [1:3] "126" NA NA
## .. .. .. .. ..$ widewidth : chr [1:3] "190" NA NA
## .. .. .. .. ..$ xlargewidth : chr [1:3] NA "600" NA
## .. .. .. .. ..$ xlarge : chr [1:3] NA "images/2015/06/30/business/30oracle-web/30oracle-web-articleLarge.jpg" NA
## .. .. .. .. ..$ xlargeheight : chr [1:3] NA "404" NA
## .. .. .. .. ..$ thumbnailheight: chr [1:3] NA NA "75"
## .. .. .. .. ..$ thumbnail : chr [1:3] NA NA "images/2015/06/30/business/30oracle-web/30oracle-web-thumbStandard.jpg"
## .. .. .. .. ..$ thumbnailwidth : chr [1:3] NA NA "75"
## .. .. .. ..$ type : chr [1:3] "image" "image" "image"
## .. .. ..$ :'data.frame': 0 obs. of 0 variables
## .. .. ..$ :'data.frame': 3 obs. of 6 variables:
## .. .. .. ..$ width : int [1:3] 190 600 75
## .. .. .. ..$ url : chr [1:3] "images/2014/08/28/nyregion/y-jpCOURSES1/y-jpCOURSES1-thumbWide.jpg" "images/2014/08/28/nyregion/y-jpCOURSES1/y-jpCOURSES1-articleLarge.jpg" "images/2014/08/28/nyregion/y-jpCOURSES1/y-jpCOURSES1-thumbStandard.jpg"
## .. .. .. ..$ height : int [1:3] 126 400 75
## .. .. .. ..$ subtype: chr [1:3] "wide" "xlarge" "thumbnail"
## .. .. .. ..$ legacy :'data.frame': 3 obs. of 9 variables:
## .. .. .. .. ..$ wide : chr [1:3] "images/2014/08/28/nyregion/y-jpCOURSES1/y-jpCOURSES1-thumbWide.jpg" NA NA
## .. .. .. .. ..$ wideheight : chr [1:3] "126" NA NA
## .. .. .. .. ..$ widewidth : chr [1:3] "190" NA NA
## .. .. .. .. ..$ xlargewidth : chr [1:3] NA "600" NA
## .. .. .. .. ..$ xlarge : chr [1:3] NA "images/2014/08/28/nyregion/y-jpCOURSES1/y-jpCOURSES1-articleLarge.jpg" NA
## .. .. .. .. ..$ xlargeheight : chr [1:3] NA "400" NA
## .. .. .. .. ..$ thumbnailheight: chr [1:3] NA NA "75"
## .. .. .. .. ..$ thumbnail : chr [1:3] NA NA "images/2014/08/28/nyregion/y-jpCOURSES1/y-jpCOURSES1-thumbStandard.jpg"
## .. .. .. .. ..$ thumbnailwidth : chr [1:3] NA NA "75"
## .. .. .. ..$ type : chr [1:3] "image" "image" "image"
## .. .. ..$ :'data.frame': 3 obs. of 6 variables:
## .. .. .. ..$ width : int [1:3] 190 600 75
## .. .. .. ..$ url : chr [1:3] "images/2014/05/28/business/28SamsungHealth/28SamsungHealth-thumbWide.jpg" "images/2014/05/28/business/28SamsungHealth/28SamsungHealth-articleLarge.jpg" "images/2014/05/28/business/28SamsungHealth/28SamsungHealth-thumbStandard.jpg"
## .. .. .. ..$ height : int [1:3] 126 354 75
## .. .. .. ..$ subtype: chr [1:3] "wide" "xlarge" "thumbnail"
## .. .. .. ..$ legacy :'data.frame': 3 obs. of 9 variables:
## .. .. .. .. ..$ wide : chr [1:3] "images/2014/05/28/business/28SamsungHealth/28SamsungHealth-thumbWide.jpg" NA NA
## .. .. .. .. ..$ wideheight : chr [1:3] "126" NA NA
## .. .. .. .. ..$ widewidth : chr [1:3] "190" NA NA
## .. .. .. .. ..$ xlargewidth : chr [1:3] NA "600" NA
## .. .. .. .. ..$ xlarge : chr [1:3] NA "images/2014/05/28/business/28SamsungHealth/28SamsungHealth-articleLarge.jpg" NA
## .. .. .. .. ..$ xlargeheight : chr [1:3] NA "354" NA
## .. .. .. .. ..$ thumbnailheight: chr [1:3] NA NA "75"
## .. .. .. .. ..$ thumbnail : chr [1:3] NA NA "images/2014/05/28/business/28SamsungHealth/28SamsungHealth-thumbStandard.jpg"
## .. .. .. .. ..$ thumbnailwidth : chr [1:3] NA NA "75"
## .. .. .. ..$ type : chr [1:3] "image" "image" "image"
## .. .. ..$ :'data.frame': 0 obs. of 0 variables
## .. .. ..$ :'data.frame': 3 obs. of 6 variables:
## .. .. .. ..$ subtype: chr [1:3] "wide" "xlarge" "thumbnail"
## .. .. .. ..$ url : chr [1:3] "images/2014/03/10/magazine/mag-16Silicon/mag-16Silicon-thumbWide-v4.png" "images/2014/03/10/magazine/mag-16Silicon/mag-16Silicon-articleLarge-v4.png" "images/2014/03/10/magazine/mag-16Silicon/mag-16Silicon-thumbStandard-v4.jpg"
## .. .. .. ..$ height : int [1:3] 126 337 75
## .. .. .. ..$ width : int [1:3] 190 600 75
## .. .. .. ..$ legacy :'data.frame': 3 obs. of 9 variables:
## .. .. .. .. ..$ wide : chr [1:3] "images/2014/03/10/magazine/mag-16Silicon/mag-16Silicon-thumbWide-v4.png" NA NA
## .. .. .. .. ..$ wideheight : chr [1:3] "126" NA NA
## .. .. .. .. ..$ widewidth : chr [1:3] "190" NA NA
## .. .. .. .. ..$ xlargewidth : chr [1:3] NA "600" NA
## .. .. .. .. ..$ xlarge : chr [1:3] NA "images/2014/03/10/magazine/mag-16Silicon/mag-16Silicon-articleLarge-v4.png" NA
## .. .. .. .. ..$ xlargeheight : chr [1:3] NA "337" NA
## .. .. .. .. ..$ thumbnailheight: chr [1:3] NA NA "75"
## .. .. .. .. ..$ thumbnail : chr [1:3] NA NA "images/2014/03/10/magazine/mag-16Silicon/mag-16Silicon-thumbStandard-v4.jpg"
## .. .. .. .. ..$ thumbnailwidth : chr [1:3] NA NA "75"
## .. .. .. ..$ type : chr [1:3] "image" "image" "image"
## .. .. ..$ :'data.frame': 3 obs. of 6 variables:
## .. .. .. ..$ subtype: chr [1:3] "wide" "xlarge" "thumbnail"
## .. .. .. ..$ url : chr [1:3] "images/2013/12/15/magazine/mag-15Google-t_CA2/mag-15Google-t_CA2-thumbWide-v4.png" "images/2013/12/15/magazine/mag-15Google-t_CA2/mag-15Google-t_CA2-articleLarge-v4.png" "images/2013/12/11/magazine/11-google-maps/11-google-maps-thumbStandard.jpg"
## .. .. .. ..$ height : int [1:3] 126 598 75
## .. .. .. ..$ width : int [1:3] 190 600 75
## .. .. .. ..$ legacy :'data.frame': 3 obs. of 9 variables:
## .. .. .. .. ..$ wide : chr [1:3] "images/2013/12/15/magazine/mag-15Google-t_CA2/mag-15Google-t_CA2-thumbWide-v4.png" NA NA
## .. .. .. .. ..$ wideheight : chr [1:3] "126" NA NA
## .. .. .. .. ..$ widewidth : chr [1:3] "190" NA NA
## .. .. .. .. ..$ xlargewidth : chr [1:3] NA "600" NA
## .. .. .. .. ..$ xlarge : chr [1:3] NA "images/2013/12/15/magazine/mag-15Google-t_CA2/mag-15Google-t_CA2-articleLarge-v4.png" NA
## .. .. .. .. ..$ xlargeheight : chr [1:3] NA "598" NA
## .. .. .. .. ..$ thumbnailheight: chr [1:3] NA NA "75"
## .. .. .. .. ..$ thumbnail : chr [1:3] NA NA "images/2013/12/11/magazine/11-google-maps/11-google-maps-thumbStandard.jpg"
## .. .. .. .. ..$ thumbnailwidth : chr [1:3] NA NA "75"
## .. .. .. ..$ type : chr [1:3] "image" "image" "image"
## .. .. ..$ :'data.frame': 3 obs. of 6 variables:
## .. .. .. ..$ width : int [1:3] 190 600 75
## .. .. .. ..$ url : chr [1:3] "images/2013/11/11/business/platform/platform-thumbWide.jpg" "images/2013/11/11/business/platform/platform-articleLarge.jpg" "images/2013/11/11/business/platform/platform-thumbStandard-v2.jpg"
## .. .. .. ..$ height : int [1:3] 126 400 75
## .. .. .. ..$ subtype: chr [1:3] "wide" "xlarge" "thumbnail"
## .. .. .. ..$ legacy :'data.frame': 3 obs. of 9 variables:
## .. .. .. .. ..$ wide : chr [1:3] "images/2013/11/11/business/platform/platform-thumbWide.jpg" NA NA
## .. .. .. .. ..$ wideheight : chr [1:3] "126" NA NA
## .. .. .. .. ..$ widewidth : chr [1:3] "190" NA NA
## .. .. .. .. ..$ xlargewidth : chr [1:3] NA "600" NA
## .. .. .. .. ..$ xlarge : chr [1:3] NA "images/2013/11/11/business/platform/platform-articleLarge.jpg" NA
## .. .. .. .. ..$ xlargeheight : chr [1:3] NA "400" NA
## .. .. .. .. ..$ thumbnailheight: chr [1:3] NA NA "75"
## .. .. .. .. ..$ thumbnail : chr [1:3] NA NA "images/2013/11/11/business/platform/platform-thumbStandard-v2.jpg"
## .. .. .. .. ..$ thumbnailwidth : chr [1:3] NA NA "75"
## .. .. .. ..$ type : chr [1:3] "image" "image" "image"
## .. .. ..$ :'data.frame': 0 obs. of 0 variables
## .. .. ..$ :'data.frame': 3 obs. of 6 variables:
## .. .. .. ..$ width : int [1:3] 190 600 75
## .. .. .. ..$ url : chr [1:3] "images/2013/01/10/technology/10bits-ivee/10bits-ivee-thumbWide.jpg" "images/2013/01/10/technology/10bits-ivee/10bits-ivee-articleLarge.jpg" "images/2013/01/10/technology/10bits-ivee/10bits-ivee-thumbStandard.jpg"
## .. .. .. ..$ height : int [1:3] 126 437 75
## .. .. .. ..$ subtype: chr [1:3] "wide" "xlarge" "thumbnail"
## .. .. .. ..$ legacy :'data.frame': 3 obs. of 9 variables:
## .. .. .. .. ..$ wide : chr [1:3] "images/2013/01/10/technology/10bits-ivee/10bits-ivee-thumbWide.jpg" NA NA
## .. .. .. .. ..$ wideheight : chr [1:3] "126" NA NA
## .. .. .. .. ..$ widewidth : chr [1:3] "190" NA NA
## .. .. .. .. ..$ xlargewidth : chr [1:3] NA "600" NA
## .. .. .. .. ..$ xlarge : chr [1:3] NA "images/2013/01/10/technology/10bits-ivee/10bits-ivee-articleLarge.jpg" NA
## .. .. .. .. ..$ xlargeheight : chr [1:3] NA "437" NA
## .. .. .. .. ..$ thumbnailheight: chr [1:3] NA NA "75"
## .. .. .. .. ..$ thumbnail : chr [1:3] NA NA "images/2013/01/10/technology/10bits-ivee/10bits-ivee-thumbStandard.jpg"
## .. .. .. .. ..$ thumbnailwidth : chr [1:3] NA NA "75"
## .. .. .. ..$ type : chr [1:3] "image" "image" "image"
## .. ..$ headline :'data.frame': 10 obs. of 3 variables:
## .. .. ..$ main : chr [1:10] "Supreme Court Declines to Hear Appeal in Google-Oracle Copyright Fight" "Google Asks Supreme Court to Decide Oracle Copyright Fight" "Student-Built Apps Teach Colleges a Thing or Two" "Samsung Stakes Claim on Wearable Tech That Monitors Health" ...
## .. .. ..$ kicker : chr [1:10] "Bits" NA NA "Bits" ...
## .. .. ..$ print_headline: chr [1:10] "Supreme Court Declines to Hear Google-Oracle Appeal" "Google Asks Supreme Court to Decide Oracle Copyright Fight" "Students<U+0092> Apps Teach Colleges a Thing or Two""| __truncated__ NA ...
## .. ..$ keywords :List of 10
## .. .. ..$ :'data.frame': 5 obs. of 3 variables:
## .. .. .. ..$ rank : chr [1:5] "1" "2" "3" "1" ...
## .. .. .. ..$ name : chr [1:5] "organizations" "organizations" "organizations" "subject" ...
## .. .. .. ..$ value: chr [1:5] "Google Inc" "Oracle Corporation" "Supreme Court (US)" "Android (Operating System)" ...
## .. .. ..$ :'data.frame': 0 obs. of 0 variables
## .. .. ..$ :'data.frame': 3 obs. of 4 variables:
## .. .. .. ..$ rank : chr [1:3] "1" "2" "3"
## .. .. .. ..$ is_major: chr [1:3] "Y" "Y" "N"
## .. .. .. ..$ value : chr [1:3] "Colleges and Universities" "Computers and the Internet" "Software"
## .. .. .. ..$ name : chr [1:3] "subject" "subject" "subject"
## .. .. ..$ :'data.frame': 9 obs. of 3 variables:
## .. .. .. ..$ rank : chr [1:9] "2" "1" "2" "1" ...
## .. .. .. ..$ name : chr [1:9] "glocations" "glocations" "organizations" "organizations" ...
## .. .. .. ..$ value: chr [1:9] "United States" "San Francisco (Calif)" "Samsung Group" "Apple Inc" ...
## .. .. ..$ :'data.frame': 0 obs. of 0 variables
## .. .. ..$ :'data.frame': 9 obs. of 4 variables:
## .. .. .. ..$ value : chr [1:9] "Silicon Valley (Calif)" "Computers and the Internet" "Engineering and Engineers" "Start-ups" ...
## .. .. .. ..$ is_major: chr [1:9] "N" "Y" "N" "N" ...
## .. .. .. ..$ rank : chr [1:9] "1" "2" "3" "4" ...
## .. .. .. ..$ name : chr [1:9] "glocations" "subject" "subject" "subject" ...
## .. .. ..$ :'data.frame': 6 obs. of 4 variables:
## .. .. .. ..$ value : chr [1:6] "Google Street View" "Vincent, Luc" "Maps" "Computers and the Internet" ...
## .. .. .. ..$ is_major: chr [1:6] "N" "N" "Y" "N" ...
## .. .. .. ..$ rank : chr [1:6] "5" "1" "3" "4" ...
## .. .. .. ..$ name : chr [1:6] "organizations" "persons" "subject" "subject" ...
## .. .. ..$ :'data.frame': 4 obs. of 4 variables:
## .. .. .. ..$ rank : chr [1:4] "3" "1" "2" "4"
## .. .. .. ..$ is_major: chr [1:4] "N" "Y" "Y" "N"
## .. .. .. ..$ value : chr [1:4] "Start-ups" "Twitter" "Social Media" "Online Advertising"
## .. .. .. ..$ name : chr [1:4] "subject" "organizations" "subject" "subject"
## .. .. ..$ :'data.frame': 8 obs. of 3 variables:
## .. .. .. ..$ rank : chr [1:8] "1" "2" "3" "4" ...
## .. .. .. ..$ name : chr [1:8] "organizations" "organizations" "organizations" "organizations" ...
## .. .. .. ..$ value: chr [1:8] "AT&T Inc" "Buick Division of General Motors Corp" "Cadillac Division of General Motors Corp" "Chevrolet Division of General Motors Corp" ...
## .. .. ..$ :'data.frame': 0 obs. of 0 variables
## .. ..$ pub_date : chr [1:10] "2015-06-29T19:46:39Z" "2014-10-08T17:53:36Z" "2014-08-28T00:00:00Z" "2014-05-29T00:29:06Z" ...
## .. ..$ document_type : chr [1:10] "blogpost" "article" "article" "blogpost" ...
## .. ..$ news_desk : chr [1:10] "Business" "None" "Metro" "Business" ...
## .. ..$ section_name : chr [1:10] "Technology" "Technology" "N.Y. / Region" "Technology" ...
## .. ..$ subsection_name : logi [1:10] NA NA NA NA NA NA ...
## .. ..$ byline :'data.frame': 10 obs. of 4 variables:
## .. .. ..$ person :List of 10
## .. .. .. ..$ :'data.frame': 1 obs. of 5 variables:
## .. .. .. .. ..$ organization: chr ""
## .. .. .. .. ..$ role : chr "reported"
## .. .. .. .. ..$ firstname : chr "Quentin"
## .. .. .. .. ..$ rank : int 1
## .. .. .. .. ..$ lastname : chr "HARDY"
## .. .. .. ..$ :'data.frame': 0 obs. of 0 variables
## .. .. .. ..$ :'data.frame': 1 obs. of 5 variables:
## .. .. .. .. ..$ organization: chr ""
## .. .. .. .. ..$ role : chr "reported"
## .. .. .. .. ..$ firstname : chr "Ariel"
## .. .. .. .. ..$ rank : int 1
## .. .. .. .. ..$ lastname : chr "KAMINER"
## .. .. .. ..$ :'data.frame': 1 obs. of 5 variables:
## .. .. .. .. ..$ organization: chr ""
## .. .. .. .. ..$ role : chr "reported"
## .. .. .. .. ..$ firstname : chr "Molly"
## .. .. .. .. ..$ rank : int 1
## .. .. .. .. ..$ lastname : chr "WOOD"
## .. .. .. ..$ :'data.frame': 0 obs. of 0 variables
## .. .. .. ..$ :'data.frame': 1 obs. of 5 variables:
## .. .. .. .. ..$ organization: chr ""
## .. .. .. .. ..$ role : chr "reported"
## .. .. .. .. ..$ rank : int 1
## .. .. .. .. ..$ firstname : chr "Yiren"
## .. .. .. .. ..$ lastname : chr "LU"
## .. .. .. ..$ :'data.frame': 1 obs. of 5 variables:
## .. .. .. .. ..$ organization: chr ""
## .. .. .. .. ..$ role : chr "reported"
## .. .. .. .. ..$ rank : int 1
## .. .. .. .. ..$ firstname : chr "Adam"
## .. .. .. .. ..$ lastname : chr "FISHER"
## .. .. .. ..$ :'data.frame': 1 obs. of 5 variables:
## .. .. .. .. ..$ organization: chr ""
## .. .. .. .. ..$ role : chr "reported"
## .. .. .. .. ..$ firstname : chr "Vindu"
## .. .. .. .. ..$ rank : int 1
## .. .. .. .. ..$ lastname : chr "GOEL"
## .. .. .. ..$ :'data.frame': 1 obs. of 5 variables:
## .. .. .. .. ..$ organization: chr ""
## .. .. .. .. ..$ role : chr "reported"
## .. .. .. .. ..$ firstname : chr "Paul"
## .. .. .. .. ..$ rank : int 1
## .. .. .. .. ..$ lastname : chr "STENQUIST"
## .. .. .. ..$ :'data.frame': 1 obs. of 5 variables:
## .. .. .. .. ..$ organization: chr ""
## .. .. .. .. ..$ role : chr "reported"
## .. .. .. .. ..$ firstname : chr "Roy"
## .. .. .. .. ..$ rank : int 1
## .. .. .. .. ..$ lastname : chr "FURCHGOTT"
## .. .. ..$ original : chr [1:10] "By QUENTIN HARDY" "By REUTERS" "By ARIEL KAMINER" "By MOLLY WOOD" ...
## .. .. ..$ organization: chr [1:10] NA "REUTERS" NA NA ...
## .. .. ..$ contributor : chr [1:10] NA NA "" NA ...
## .. ..$ type_of_material : chr [1:10] "Blog" "News" "News" "Blog" ...
## .. ..$ _id : chr [1:10] "5591d941798810525124d243" "5435b2c6798810520e354b4e" "53fe859d7988106d48b1fc71" "5386b7f07988101cbeba0057" ...
## .. ..$ word_count : chr [1:10] "639" "259" "1332" "816" ...
## .. ..$ slideshow_credits: logi [1:10] NA NA NA NA NA NA ...
## $ status : chr "OK"
## $ copyright: chr "Copyright (c) 2013 The New York Times Company. All Rights Reserved."
We see from our test that we get a list of 3. List 2, test[2] is a simple status (“OK”), which may be useful in some advanced error checking, but I am ignoring for now. List 3, or test[3], is a copyright statement from the New York Times, which I will ignore too. The search responses we want are in the first list (test[1]).
With a little more investigation we see that the part of the list we want is test[[1]]$docs. We can examine the 20 variables and decide which ones we want. Here are the variables.
I decide that headline, pub_date, web_url, and maybe snippet would make a good response to a search. After putting those 4 variables into a dataframe I find headline is really 3 values (main, kicker, and print_headline). After examining my example I decide main is the one I want.
test.df <- data.frame(test[[1]]$docs)
variable.names(test.df)
## [1] "web_url" "snippet" "lead_paragraph"
## [4] "abstract" "print_page" "blog"
## [7] "source" "multimedia" "headline"
## [10] "keywords" "pub_date" "document_type"
## [13] "news_desk" "section_name" "subsection_name"
## [16] "byline" "type_of_material" "X_id"
## [19] "word_count" "slideshow_credits"
# Structure a dataframe to return
response <- data.frame(test.df$headline, test.df$pub_date, test.df$web_url, test.df$snippet)
str(response)
## 'data.frame': 10 obs. of 6 variables:
## $ main : chr "Supreme Court Declines to Hear Appeal in Google-Oracle Copyright Fight" "Google Asks Supreme Court to Decide Oracle Copyright Fight" "Student-Built Apps Teach Colleges a Thing or Two" "Samsung Stakes Claim on Wearable Tech That Monitors Health" ...
## $ kicker : chr "Bits" NA NA "Bits" ...
## $ print_headline : chr "Supreme Court Declines to Hear Google-Oracle Appeal" "Google Asks Supreme Court to Decide Oracle Copyright Fight" "Students<U+0092> Apps Teach Colleges a Thing or Two""| __truncated__ NA ...
## $ test.df.pub_date: Factor w/ 10 levels "2013-01-11T13:00:37Z",..: 10 9 8 7 6 5 4 3 2 1
## $ test.df.web_url : Factor w/ 10 levels "http://bits.blogs.nytimes.com/2013/01/11/c-e-s-2013-the-voice-controlled-home-with-a-catch/",..: 3 10 8 2 9 7 6 5 4 1
## $ test.df.snippet : Factor w/ 10 levels "A years-long copyright fight between Google and Oracle will continue. At issue are the bits of code that help pieces of softwar"| __truncated__,..: 1 4 10 8 7 5 6 9 3 2
In the code below I take the ideas from above to write a function to do a simple search using New York Times Search API. The function will have two parameters, the search topic and what responses to return. After the function I run it using a few examples.
I call this function getNYTsearch and it’s parameters are topic and response. I use a simple error handling and return some simple instructions, if no parameters are entered.
getNYTsearch <- function(topic = "", response = "") {
## Give some instruction, if no parameters are entered
if (topic == "") {
stop('The getNYTsearch function requires a search topic to work. Please enter getNYTsearch(topic = "titanic", response = "new"). response can be o, old, n, or new. If no value for response is entered, the 10 most relevant hits are returned.')
}
## Put the topic in search API format
topic <- gsub(" ", "+", topic)
## Check response and set appropriate searchurl if valid
if (!response %in% c("o", "n", "old", "new", "", "O", "N", "Old", "New")) {
stop("Wrong response parameter. Choose either '0' for oldest or 'n' for newest or leave blank '' for most relevant.")
}
if (response == "o" || response == "O" || response == "old" || response == "Old") {
searchurl <- "http://api.nytimes.com/svc/search/v2/articlesearch.json?q=%s&sort=oldest&api-key=91d71cc6a4bdd339cb45f37747025836:18:62602330"
}
if (response == "n" || response == "N" || response == "new" || response == "New") {
searchurl <- "http://api.nytimes.com/svc/search/v2/articlesearch.json?q=%s&sort=newest&api-key=91d71cc6a4bdd339cb45f37747025836:18:62602330"
}
if (response == "") {
searchurl <- "http://api.nytimes.com/svc/search/v2/articlesearch.json?q=%s&api-key=91d71cc6a4bdd339cb45f37747025836:18:62602330"
}
## Get search results
searchurl <- sprintf(searchurl, topic)
fullreply <- fromJSON(searchurl)
## Construct Dataframe to Return
reply <- data.frame(fullreply$response$docs$headline$main, fullreply$response$docs$pub_date, fullreply$response$docs$web_url, fullreply$response$docs$snippet, stringsAsFactors = FALSE)
colnames(reply) <- c("Headline", "Date", "URL", "Snippet")
reply$Date <- substr(reply$Date, 1, 10)
return(reply)
}
We run through this list of tests.
I use tbl_df from dplyr for ease of reading. They all seem to work.
# getNYTsearch()
# getNYTsearch("big data", "K")
tbl_df(getNYTsearch("big data"))
## Source: local data frame [10 x 4]
##
## Headline
## (chr)
## 1 If Algorithms Know All, How Much Should Humans Help?
## 2 A Changing West Village Landscape
## 3 Big
## 4 Big
## 5 Faltering TV Show Hits Stride on Web
## 6 For New York<U+0092>s Pools, It<U+0092>s Not the Heat, It<U+0092>s the Politics
## 7 Looking at the Promise and Perils of the Emerging Big Data Sector
## 8 First Data Seeks to Raise $3.2 Billion in I.P.O.
## 9 Geography
## 10 Big Data Gets Its Own Photo Album
## Variables not shown: Date (chr), URL (chr), Snippet (chr)
tbl_df(getNYTsearch("big data", "o"))
## Source: local data frame [10 x 4]
##
## Headline
## (chr)
## 1 Twelve Days Later from California; ARRIVAL OF THE ILLINOIS. NEARLY TWO MILL
## 2 The Broadway Railway-Reply to Anti-Monopoly, No. 3.
## 3 LATEST INTELLIGENCE; By Telegraph to the New-York Daily Times XXXIId CONGRE
## 4 FINANCIAL.
## 5 FINANCIAL.
## 6 FIFTEEN DAYS LATER FROM CALIFORNIA.; Arrival of the Northern Light, via Nic
## 7 NEW-YORK CITY.; THE STRIKE. The Employing Painters and Journeymen in the Fi
## 8 NEW-YORK CITY.; THE CATHOLIC HISTORY OF AMERICA, LEOTURS THREE. The Cathoti
## 9 REV. HENRY GILES' LECTURES--No. II.; FALSE AND EXAGGERATED EULOGY IN POPULA
## 10 FRANCE.; Political, Personal, and Miscelaneous Gossip.
## Variables not shown: Date (chr), URL (chr), Snippet (chr)
tbl_df(getNYTsearch("big data", "n"))
## Source: local data frame [10 x 4]
##
## Headline
## (chr)
## 1 In Arbitration, a <U+0091>Privatization of the Justice System<U+0092>
## 2 Corked? Fine Wines Languish in China Warehouses as Consumers Cool
## 3 Tax Breaks Produce Surge for Film Industry in Los Angeles
## 4 'Burnt,' 'Crisis,' Add to a Pileup of Flops at Box Office
## 5 Candidates Follow Informal Rules in New Hampshire
## 6 Prices, Politics Challenge Health Law's 3rd Sign-Up Season
## 7 SAP Chief Bill McDermott Embarks on Health Care Mission After Losing His Ey
## 8 China's Factory and Service Activity Show Economy Still Unsteady
## 9 AP: Hundreds of Officers Lose Licenses Over Sex Misconduct
## 10 Silicon Valley<U+0092>s New Philanthropy
## Variables not shown: Date (chr), URL (chr), Snippet (chr)