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.
options(stringsAsFactors = FALSE)
library(httr)
library(jsonlite)
library(DT)
library(knitr)
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
#Most emailed blog posts and articles
url <- "http://api.nytimes.com/svc/mostpopular/v2/mostemailed/all-sections/1.json"
url <- paste(url, api_key, sep="")
x <-fromJSON(url)
names(x)
## [1] "status" "copyright" "num_results" "results"
#Create Data Frame
df <- jsonlite::fromJSON(url, flatten = TRUE)
datatable(x$results)