Load the following packages:

library(httr)
library(jsonlite)
library(tidyverse)
## Warning: package 'tidyverse' was built under R version 3.4.3
## -- Attaching packages ---------------------------------- tidyverse 1.2.1 --
## v ggplot2 2.2.1     v purrr   0.2.4
## v tibble  1.4.1     v dplyr   0.7.4
## v tidyr   0.7.2     v stringr 1.2.0
## v readr   1.1.1     v forcats 0.2.0
## Warning: package 'tibble' was built under R version 3.4.3
## Warning: package 'tidyr' was built under R version 3.4.3
## Warning: package 'readr' was built under R version 3.4.3
## Warning: package 'purrr' was built under R version 3.4.3
## Warning: package 'dplyr' was built under R version 3.4.2
## Warning: package 'forcats' was built under R version 3.4.3
## -- Conflicts ------------------------------------- tidyverse_conflicts() --
## x dplyr::filter()  masks stats::filter()
## x purrr::flatten() masks jsonlite::flatten()
## x dplyr::lag()     masks stats::lag()
library(knitr)

Using the httr package obtain data from the New York Times API using the api key: e2b1750f30c84c02bd789e74066db5c8

movies <- GET("https://api.nytimes.com/svc/movies/v2/reviews/search.json?api-key=e2b1750f30c84c02bd789e74066db5c8")
movies
## Response [https://api.nytimes.com/svc/movies/v2/reviews/search.json?api-key=e2b1750f30c84c02bd789e74066db5c8]
##   Date: 2018-04-01 21:25
##   Status: 200
##   Content-Type: application/json; charset=UTF-8
##   Size: 16.6 kB

Using the jsonlite package converts movies into a data frame entitled movie_frame

movie_frame <- fromJSON("https://api.nytimes.com/svc/movies/v2/reviews/search.json?api-key=e2b1750f30c84c02bd789e74066db5c8") %>% data.frame()

Using the glimpse function from the tidyverse look at the 20 observations of the movie_frame

glimpse(movie_frame)
## Observations: 20
## Variables: 15
## $ status                   <fctr> OK, OK, OK, OK, OK, OK, OK, OK, OK, ...
## $ copyright                <fctr> Copyright (c) 2018 The New York Time...
## $ has_more                 <lgl> TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, T...
## $ num_results              <int> 20, 20, 20, 20, 20, 20, 20, 20, 20, 2...
## $ results.display_title    <chr> "Tyler Perry's Acrimony", "Wilde Salo...
## $ results.mpaa_rating      <chr> "R", "R", "R", "", "", "", "R", "", "...
## $ results.critics_pick     <int> 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0...
## $ results.byline           <chr> "BEN KENIGSBERG", "GLENN KENNY", "GLE...
## $ results.headline         <chr> "Review: In <U+0091>Acrimony,<U+0092> Taraji P. Hen...
## $ results.summary_short    <chr> "The Tyler Perry melodrama follows a ...
## $ results.publication_date <chr> "2018-03-30", "2018-03-29", "2018-03-...
## $ results.opening_date     <chr> "2018-03-30", "2017-04-01", NA, NA, "...
## $ results.date_updated     <chr> "2018-04-01 16:44:31", "2018-04-01 16...
## $ results.link             <data.frame> c("article", "article", "artic...
## $ results.multimedia       <data.frame> c("mediumThreeByTwo210", "medi...

Using colnames view the column names

colnames(movie_frame)
##  [1] "status"                   "copyright"               
##  [3] "has_more"                 "num_results"             
##  [5] "results.display_title"    "results.mpaa_rating"     
##  [7] "results.critics_pick"     "results.byline"          
##  [9] "results.headline"         "results.summary_short"   
## [11] "results.publication_date" "results.opening_date"    
## [13] "results.date_updated"     "results.link"            
## [15] "results.multimedia"

Create a tibble entitled movie_c which will keep a handful of pertinent variables.

movie_c <- movie_frame %>% select(results.display_title, results.mpaa_rating, results.critics_pick, results.byline,results.summary_short, results.publication_date,results.opening_date)

Rename the column headers and create a new tibble named movies_final

movie_final <- movie_c %>% rename(Title = results.display_title,
                                  Rating = results.mpaa_rating,
                                  CriticPick = results.critics_pick,
                                  Author = results.byline,
                                  Summary = results.summary_short,
                                  PubDate = results.publication_date,
                                  OpeningDate = results.opening_date)

View the data using the knitr package

kable(movie_final, format = "html")
Title Rating CriticPick Author Summary PubDate OpeningDate
Tyler Perry’s Acrimony R 0 BEN KENIGSBERG The Tyler Perry melodrama follows a woman who undergoes trials brought on by a cheating husband (Lyriq Bent). 2018-03-30 2018-03-30
Wilde Salomé R 1 GLENN KENNY A story of obsession plays out in “Wilde Salomé” and “Salomé,” as Mr. Pacino veers into Camp. 2018-03-29 2017-04-01
Salomé R 1 GLENN KENNY A story of obsession plays out in “Wilde Salomé” and “Salomé,” as Mr. Pacino veers into Camp. 2018-03-29 NA
Personal Problems 1 GLENN KENNY The brainchild of the writer Ishmael Reed and the director Bill Gunn, this film is an uncategorizable work of art — and an engrossing one. 2018-03-29 NA
Love After Love 1 JEANNETTE CATSOULIS Russ Harbaugh’s debut feature delivers something rarely seen in American movies: a warts-and-all examination of extended grief. 2018-03-29 2018-03-30
Outside In 1 JEANNETTE CATSOULIS Edie Falco and Jay Duplass connect romantically in this life-after-prison drama that prioritizes patience and pragmatism over passion. 2018-03-29 2018-04-03
Gemini R 0 MANOHLA DARGIS The director Aaron Katz plays with film noir conventions in this pleasurably drifty, low-wattage mystery. 2018-03-29 2018-03-30
The Gardener 0 HELEN T. VERONGOS Frank Cabot’s garden in Quebec is in part an amalgamation of others that inspired him in his travels. 2018-03-29 2018-03-30
After Louie 0 KEN JAWOROWSKI The film, starring Alan Cumming, centers on a 50-something man who lived through the worst years of the AIDS epidemic. 2018-03-29 2018-03-30
All I Wish 0 TEO BUGBEE A fine performance by Ms. Stone is up against a generic screenplay. 2018-03-29 2018-03-30
The Last Movie Star R 0 BEN KENIGSBERG The film effectively allows the ever-assured actor to score a touchdown on an empty field. 2018-03-29 2018-03-30
The China Hustle R 0 BEN KENIGSBERG A documentary may be the wrong delivery mechanism for the byzantine exposé that cries out for detailed news reporting. 2018-03-29 2018-03-23
Finding Your Feet PG-13 0 JEANNETTE CATSOULIS Led by a charming pairing of Imelda Staunton and Celia Imrie, this British retiree rom-com delivers exactly what it promises. 2018-03-29 NA
Ready Player One PG-13 0 A. O. SCOTT The movie, based on Ernest Cline’s best-selling novel, is set in a dystopian future where a virtual video-game reality reigns, and pop-culture callbacks are legion. 2018-03-28 2018-03-29
The Great Silence Not Rated 0 A. O. SCOTT Klaus Kinski and Jean-Louis Trintignant face off in the snows of Utah in a bloody genre exercise that is only now receiving a proper U.S. release. 2018-03-28 1969-00-00
Midnight Sun PG-13 0 TEO BUGBEE Bella Thorne stars as a teenager with a rare disease who must avoid ultraviolet light — but she isn’t avoiding love. One night, she meets a boy. 2018-03-23 2018-03-23
Ismael’s Ghosts R 1 GLENN KENNY In Arnaud Desplechin’s remarkable sprawl of a film, a wife comes back after a 20-year disappearance, adding to an already convoluted situation. 2018-03-22 2018-03-23
Beauty and the Dogs 1 JEANNETTE CATSOULIS In this film inspired by a true story, the director Kaouther Ben Hania leans hard on official corruption and a bureaucracy dominated by male power. 2018-03-22 NA
The Workshop 1 JENNIFER SZALAI This new film from the French director Laurent Cantet follows a diverse group of students enrolled in a summer writing class taught by a famous novelist. 2018-03-22 NA
I Kill Giants Not Rated 1 JEANNETTE CATSOULIS This magical movie marries adult themes and childlike wonder as a troubled girl embarks on a fantastical quest. 2018-03-22 2018-03-23