#install.packages("jsonlite")
library("jsonlite")
## Warning: package 'jsonlite' was built under R version 3.1.3
##
## Attaching package: 'jsonlite'
##
## The following object is masked from 'package:utils':
##
## View
url <- "https://api.nytimes.com/svc/search/v2/articlesearch.json"
key <- "&api-key=aa73a2e1944b4060b234d81b713a8906"
query <- "?q=knicks"
queryFull <- paste(url,query,key,sep="")
data <- fromJSON(queryFull)
df <- data.frame(data$response$docs)
head(df$snippet)
## [1] "The team is now 0-2 in its first season after trading Carmelo Anthony. There is no sense of progress yet, but there are 80 games to go."
## [2] "Porzingis had 30 points and 9 rebounds as the Knicks pulled away in the third quarter from the Nets, the league’s highest-scoring team."
## [3] "Anthony scored 22 points in his first game with the Oklahoma City Thunder, which defeated his old team, the Knicks, with ease."
## [4] "While the N.B.A. is increasingly going small, the Knicks have a roster that, at least for now, includes six players who are 6 feet 10 inches or taller."
## [5] "The Knicks have put their faith in Porzingis, but nagging injuries, including a sore knee that forced him to leave practice on Thursday, continue to hound him."
## [6] "In Rio de Janeiro last year, Anthony, a cornerstone of the American team, earned his third Olympic championship."