library(httr)
library(rjson)

Pull data from NY Times API

r  = GET("https://api.nytimes.com/svc/movies/v2/reviews/search.json?api-key=014a648466f74730b89316fe78a73214")
#Tranfsorm into text
content <- content(r, "text")
#turn text into a json list
json_list <- fromJSON(content, simplify = TRUE)
#turn list into a df
nytimes_movie_df <- as.data.frame(do.call(rbind,json_list$r))
#check names of columns
colnames(nytimes_movie_df)
##  [1] "display_title"    "mpaa_rating"      "critics_pick"    
##  [4] "byline"           "headline"         "summary_short"   
##  [7] "publication_date" "opening_date"     "date_updated"    
## [10] "link"             "multimedia"

Display a sample from the whole dataframe

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
df_sample <- select(nytimes_movie_df, display_title,mpaa_rating, critics_pick, opening_date)

df_sample
##                             display_title mpaa_rating critics_pick
## 1                                 Burning   Not Rated            1
## 2               A Bread Factory, Part One                        1
## 3               A Bread Factory, Part Two                        1
## 4                       Monrovia, Indiana                        1
## 5                                  Border           R            1
## 6                                Shirkers                        1
## 7                                    Vaya                        1
## 8                                    1985                        1
## 9                                The Dark                        0
## 10                             Viper Club           R            0
## 11 Trust Machine: The Story of Blockchain                        0
## 12                               Don't Go                        0
## 13                          Hunter Killer           R            0
## 14                          London Fields           R            0
## 15                           Foreign Land                        0
## 16           Johnny English Strikes Again          PG            0
## 17                               Suspiria           R            0
## 18                    Life & Nothing More                        1
## 19                               Wildlife       PG-13            1
## 20                        Nigerian Prince                        1
##    opening_date
## 1    2018-11-09
## 2    2018-10-26
## 3    2018-10-26
## 4    2018-10-26
## 5    2018-10-26
## 6    2018-10-26
## 7          NULL
## 8          NULL
## 9    2018-10-26
## 10   2018-10-26
## 11         NULL
## 12   2018-10-26
## 13   2018-10-26
## 14   2018-10-26
## 15         NULL
## 16   2018-10-26
## 17   2018-11-02
## 18   2018-10-24
## 19         NULL
## 20         NULL

Here’s a sample of how the data frame looks. I excluded the columns with long lines of text because it makes the dataframe look messy.