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.
We have signed up for an API key and we are going to work on the API for movie reviews
#movie reviews
library(jsonlite)
##
## Attaching package: 'jsonlite'
##
## The following object is masked from 'package:utils':
##
## View
#API key
my_key <- "&api-key=e7f6c34308ad86a6f139502bdb47991c:5:73331550"
url<-"http://api.nytimes.com/svc/movies/v2/reviews/all.json?order=by-opening-date"
request <- fromJSON(paste0(url, my_key))
reviews <- request$results
colnames(reviews)
## [1] "nyt_movie_id" "display_title" "sort_name"
## [4] "mpaa_rating" "critics_pick" "thousand_best"
## [7] "byline" "headline" "capsule_review"
## [10] "summary_short" "publication_date" "opening_date"
## [13] "dvd_release_date" "date_updated" "seo_name"
## [16] "link" "related_urls" "multimedia"
df<-as.data.frame(reviews)
head(df)
## nyt_movie_id display_title sort_name mpaa_rating
## 1 571452 Bare Bare <NA>
## 2 571451 The Armor of Light Armor of Light, The PG-13
## 3 480879 Love Love NR
## 4 478699 How to Change the World How to Change the World NR
## 5 477904 The Price We Pay The Price We Pay NR
## 6 477580 Flowers Flowers <NA>
## critics_pick thousand_best byline
## 1 0 0 Neil Genzlinger
## 2 0 0 Nicolas Rapold
## 3 0 0 Jeannette Catsoulis
## 4 1 0 Daniel M. Gold
## 5 1 0 Andy Webster
## 6 0 0 Andy Webster
## headline
## 1 Review: In <U+0091>Bare,<U+0092> a Bored Woman Takes Up Pole Dancing
## 2 Review: <U+0091>The Armor of Light<U+0092> Follows 2 Unlikely Allies Against Gun Violence
## 3 Review: <U+0091>Love,<U+0092> Gaspar NoƩ<U+0092>s Romance Told Through Sex
## 4 Review: <U+0091>How to Change the World<U+0092> Traces the Roots of Greenpeace
## 5 Review: <U+0091>The Price We Pay<U+0092> Maps a Web of Offshore Tax Havens
## 6 Review: <U+0091>Flowers<U+0092> Leaves Three Women Pining for the Same Lost Love
## capsule_review
## 1
## 2
## 3
## 4
## 5
## 6
## summary_short
## 1 Dianna Agron of “Glee<U+0094> stars as someone who flees a staid existence after meeting a drug-dealing drifter.
## 2 This documentary depicts a white evangelical conservative and the mother of a black shooting victim in Florida as they press their case.
## 3
## 4 This documentary captures the excitement of the make-it-up-as-you-go early days, as well as the stresses that follow when a movement takes off.
## 5 Harold Crooks’s documentary shows how the global financial system abets the growing concentration of wealth within a narrow minority.
## 6 This melodrama directed by Jon Garaño and Jose Mari Goenaga follows how lives are altered after one woman receives anonymous weekly bouquets.
## publication_date opening_date dvd_release_date date_updated
## 1 2015-10-30 2015-10-30 <NA> 2015-10-29 18:40:17
## 2 2015-10-30 2015-10-30 <NA> 2015-10-29 18:34:07
## 3 2015-10-30 <NA> <NA> 2015-10-29 22:04:36
## 4 2015-10-30 2015-10-30 <NA> 2015-10-30 12:36:21
## 5 2015-10-30 2015-10-30 <NA> 2015-10-30 12:46:04
## 6 2015-10-30 2015-10-30 <NA> 2015-10-29 19:02:58
## seo_name link.type
## 1 Bare article
## 2 The-Armor-of-Light article
## 3 Love article
## 4 How-to-Change-the-World article
## 5 The-Price-We-Pay article
## 6 Flowers article
## link.url
## 1 http://movies.nytimes.com/2015/10/30/movies/review-in-bare-a-bored-woman-takes-up-pole-dancing.html
## 2 http://movies.nytimes.com/2015/10/30/movies/review-the-armor-of-light-follows-2-unlikely-allies-against-gun-violence.html
## 3 http://movies.nytimes.com/2015/10/30/movies/review-love-gaspar-noes-romance-told-through-sex.html
## 4 http://movies.nytimes.com/2015/10/30/movies/review-how-to-change-the-world-traces-the-roots-of-greenpeace.html
## 5 http://movies.nytimes.com/2015/10/30/movies/review-the-price-we-pay-maps-a-web-of-offshore-tax-havens.html
## 6 http://movies.nytimes.com/2015/10/30/movies/review-flowers-leaves-three-women-pining-for-the-same-lost-love.html
## link.suggested_link_text
## 1 Read the New York Times Review of Bare
## 2 Read the New York Times Review of The Armor of Light
## 3 Read the New York Times Review of Love
## 4 Read the New York Times Review of How to Change the World
## 5 Read the New York Times Review of The Price We Pay
## 6 Read the New York Times Review of Flowers
## related_urls
## 1 overview, showtimes, awards, community, trailers, http://movies.nytimes.com/movie/571452/Bare/overview, http://movies.nytimes.com/movie/571452/Bare/showtimes, http://movies.nytimes.com/movie/571452/Bare/details, http://movies.nytimes.com/movie/571452/Bare/rnr, http://movies.nytimes.com/movie/571452/Bare/trailers, Overview of Bare, Tickets & Showtimes for Bare, Cast, Credits & Awards for Bare, Readers' Reviews of Bare, Trailers & Clips for Bare
## 2 overview, showtimes, awards, community, trailers, http://movies.nytimes.com/movie/571451/The-Armor-of-Light/overview, http://movies.nytimes.com/movie/571451/The-Armor-of-Light/showtimes, http://movies.nytimes.com/movie/571451/The-Armor-of-Light/details, http://movies.nytimes.com/movie/571451/The-Armor-of-Light/rnr, http://movies.nytimes.com/movie/571451/The-Armor-of-Light/trailers, Overview of The Armor of Light, Tickets & Showtimes for The Armor of Light, Cast, Credits & Awards for The Armor of Light, Readers' Reviews of The Armor of Light, Trailers & Clips for The Armor of Light
## 3 overview, showtimes, awards, community, trailers, http://movies.nytimes.com/movie/480879/Love/overview, http://movies.nytimes.com/movie/480879/Love/showtimes, http://movies.nytimes.com/movie/480879/Love/details, http://movies.nytimes.com/movie/480879/Love/rnr, http://movies.nytimes.com/movie/480879/Love/trailers, Overview of Love, Tickets & Showtimes for Love, Cast, Credits & Awards for Love, Readers' Reviews of Love, Trailers & Clips for Love
## 4 overview, showtimes, awards, community, trailers, http://movies.nytimes.com/movie/478699/How-to-Change-the-World/overview, http://movies.nytimes.com/movie/478699/How-to-Change-the-World/showtimes, http://movies.nytimes.com/movie/478699/How-to-Change-the-World/details, http://movies.nytimes.com/movie/478699/How-to-Change-the-World/rnr, http://movies.nytimes.com/movie/478699/How-to-Change-the-World/trailers, Overview of How to Change the World, Tickets & Showtimes for How to Change the World, Cast, Credits & Awards for How to Change the World, Readers' Reviews of How to Change the World, Trailers & Clips for How to Change the World
## 5 overview, showtimes, awards, community, trailers, http://movies.nytimes.com/movie/477904/The-Price-We-Pay/overview, http://movies.nytimes.com/movie/477904/The-Price-We-Pay/showtimes, http://movies.nytimes.com/movie/477904/The-Price-We-Pay/details, http://movies.nytimes.com/movie/477904/The-Price-We-Pay/rnr, http://movies.nytimes.com/movie/477904/The-Price-We-Pay/trailers, Overview of The Price We Pay, Tickets & Showtimes for The Price We Pay, Cast, Credits & Awards for The Price We Pay, Readers' Reviews of The Price We Pay, Trailers & Clips for The Price We Pay
## 6 overview, showtimes, awards, community, trailers, http://movies.nytimes.com/movie/477580/Flowers/overview, http://movies.nytimes.com/movie/477580/Flowers/showtimes, http://movies.nytimes.com/movie/477580/Flowers/details, http://movies.nytimes.com/movie/477580/Flowers/rnr, http://movies.nytimes.com/movie/477580/Flowers/trailers, Overview of Flowers, Tickets & Showtimes for Flowers, Cast, Credits & Awards for Flowers, Readers' Reviews of Flowers, Trailers & Clips for Flowers
## multimedia.resource.type
## 1 thumbnail
## 2 thumbnail
## 3 thumbnail
## 4 thumbnail
## 5 thumbnail
## 6 thumbnail
## multimedia.resource.src
## 1 http://graphics8.nytimes.com/images/2015/10/30/arts/30BARE/30BARE-thumbStandard-v2.jpg
## 2 http://graphics8.nytimes.com/images/2015/10/30/arts/30ARMOR2/30ARMOR2-thumbStandard.jpg
## 3 http://graphics8.nytimes.com/images/2015/10/30/arts/30LOVE/30LOVE-thumbStandard.jpg
## 4 http://graphics8.nytimes.com/images/2015/10/30/arts/30HOWTOCHANGE/30HOWTOCHANGE-thumbStandard-v2.jpg
## 5 http://graphics8.nytimes.com/images/2015/10/30/arts/30PRICE/30PRICE-thumbStandard.jpg
## 6 http://graphics8.nytimes.com/images/2015/10/30/arts/30FLOWERS2/30FLOWERS2-thumbStandard.jpg
## multimedia.resource.height multimedia.resource.width
## 1 75 75
## 2 75 75
## 3 75 75
## 4 75 75
## 5 75 75
## 6 75 75