library(httr)
library(jsonlite)
library(knitr)
library(DT)
library(tidyr)
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
library(stringr)
URL <- "https://api.nytimes.com/svc/movies/v2/reviews/all.json"
Movie_reviews <- GET(URL, query = list("api-key" = "POyKM5jA9Ge2v14RA5YGz49jkJim3gj9"))
Movie_content <- content(Movie_reviews, "text")
Movie_reviews
## Response [https://api.nytimes.com/svc/movies/v2/reviews/all.json?api-key=POyKM5jA9Ge2v14RA5YGz49jkJim3gj9]
## Date: 2019-10-27 17:07
## Status: 200
## Content-Type: application/json; charset=UTF-8
## Size: 16.2 kB
Movie_data <- fromJSON(Movie_content)
Movie_df <- as.data.frame(Movie_data$results)
Movie_df
## display_title mpaa_rating critics_pick
## 1 Synonyms 1
## 2 Black and Blue R 1
## 3 Western Stars PG 1
## 4 Making Waves: The Art of Cinematic Sound 1
## 5 Burning Cane 1
## 6 The Kill Team R 0
## 7 Farming R 0
## 8 The Great Alaskan Race PG 0
## 9 Portals 0
## 10 The Gallows Act II R 0
## 11 The Current War: Director's Cut PG-13 0
## 12 Paradise Hills 0
## 13 Frankie PG-13 0
## 14 The Elephant Queen PG 1
## 15 By the Grace of God 1
## 16 The Cave PG-13 1
## 17 Wounds R 0
## 18 Jojo Rabbit PG-13 0
## 19 Kinetta 0
## 20 Maleficent: Mistress of Evil PG 0
## byline
## 1 MANOHLA DARGIS
## 2 A.O. SCOTT
## 3 KEN JAWOROWSKI
## 4 GLENN KENNY
## 5 GLENN KENNY
## 6 BEN KENIGSBERG
## 7 BEN KENIGSBERG
## 8 TEO BUGBEE
## 9 BEN KENIGSBERG
## 10 GLENN KENNY
## 11 KEN JAWOROWSKI
## 12 MANOHLA DARGIS
## 13 A.O. SCOTT
## 14 KEN JAWOROWSKI
## 15 GLENN KENNY
## 16 BEN KENIGSBERG
## 17 HELEN T. VERONGOS
## 18 A.O. SCOTT
## 19 BEN KENIGSBERG
## 20 MANOHLA DARGIS
## headline
## 1 ‘Synonyms’ Review: Brilliant. Relentless. Comic. Tragic.
## 2 ‘Black and Blue’ Review: A Cop Thriller for Our Age of Dread
## 3 ‘Western Stars’ Review: Bruce Springsteen and Broken Cowboys
## 4 ‘Making Waves’ Review: How Sound in Cinema Moves Us
## 5 ‘Burning Cane’ Review: Poverty and Despair in Rural Louisiana
## 6 ‘The Kill Team’ Review: Bullying on the Battlefield
## 7 ‘Farming’ Review: A Young Life of Self-Loathing
## 8 ‘The Great Alaskan Race’ Review: A Historic Sled Rescue Turned to Mush
## 9 ‘Portals’ Review: Snoozing Through Another Dimension
## 10 ‘The Gallows Act II’ Review: The Play’s the Thing (That Kills)
## 11 ‘The Current War’ Review: Edison vs. Westinghouse, Down to the Wire
## 12 ‘Paradise Hills’ Review: Caged Birds Singing, Maybe Escaping
## 13 ‘Frankie’ Review: Troubled in Paradise
## 14 ‘The Elephant Queen’ Review: Magnificent Images of Majestic Animals
## 15 ‘By the Grace of God’ Review: A Devastating Film About Survivors of Abuse
## 16 ‘The Cave’ Review: Do No Harm, for as Long as Possible
## 17 ‘Wounds’ Review: He Sees Dead People
## 18 ‘Jojo Rabbit’ Review: The Third Reich Wasn’t All Fun and Games
## 19 ‘Kinetta’ Review: Cryptic Seeds of Yorgos Lanthimos’s Imagery
## 20 ‘Maleficent: Mistress of Evil’ Review: Sleep, Sleep, My Lovelies
## summary_short
## 1 In this scorching movie from Nadav Lapid, a young Israeli flees to Paris and tries to transform into a Frenchman. It goes badly.
## 2 Naomie Harris plays a rookie running from bad police officers and drug dealers in Deon Taylor’s violent, astute film.
## 3 This concert film, directed by the singer and Thom Zimny, puts Bruce in a barn with an orchestra to make some magic.
## 4 A documentary provides vivid examples of the power of audio in a motion picture.
## 5 The director Phillip Youmans completed this, his first feature, while still in his teens. It feels like the work of an older, and fully formed, artist.
## 6 Alexander Skarsgard stars in a film based on the murders of Afghan civilians by American soldiers nearly a decade ago.
## 7 Adewale Akinnuoye-Agbaje looks at the impact of a British system that placed the children of African immigrants with Caucasian foster families.
## 8 Brian Presley’s film squanders the dramatic ingredients of the early-20th-century sledding adventure it’s based on.
## 9 In this science fiction anthology, encounters with interdimensional beings prove to be a complete a waste of time.
## 10 Life gets a bit too dramatic for a high school drama student in this horror film.
## 11 The film, which follows the race to bring electricity to American cities, stars Benedict Cumberbatch and Michael Shannon.
## 12 In this dystopian tale, a private treatment center turns privileged young women into smilingly compliant stereotypes.
## 13 Isabelle Huppert leads an impressive cast on a glum trip in Ira Sachs’s new film.
## 14 In footage shot over several years, this documentary follows a herd of elephants across the Kenyan savanna.
## 15 The often irreverent French director François Ozon gets serious with a fact-based story about a group of men who were childhood victims of a pedophile priest.
## 16 Feras Fayyad’s new documentary takes viewers into a subterranean Syrian hospital, as warplanes rumble overhead and bombings rattle the walls.
## 17 Armie Hammer plays a New Orleans bartender who quickly loses his friendly veneer when a spooky cellphone takes over his life.
## 18 Taika Waititi’s new film mixes farce, fantasy and drama in a Nazi-era coming-of-age story.
## 19 Set around a Greek seaside resort, the now-acclaimed director’s 2005 movie bears inklings of ideas he would explore more fully later.
## 20 Angelina Jolie returns as the powerful, dangerous fairy in this tame, disappointing follow-up to the 2014 revisionist hit.
## publication_date opening_date date_updated link.type
## 1 2019-10-24 2019-10-25 2019-10-27 16:44:22 article
## 2 2019-10-24 2019-10-25 2019-10-27 16:44:22 article
## 3 2019-10-24 2019-10-25 2019-10-27 16:44:21 article
## 4 2019-10-24 2019-10-25 2019-10-27 16:44:21 article
## 5 2019-10-24 2019-10-25 2019-10-27 16:44:20 article
## 6 2019-10-24 2019-10-25 2019-10-24 17:56:02 article
## 7 2019-10-24 <NA> 2019-10-27 16:44:21 article
## 8 2019-10-24 2019-10-25 2019-10-27 16:44:20 article
## 9 2019-10-24 2019-10-25 2019-10-24 11:04:03 article
## 10 2019-10-24 2019-10-25 2019-10-27 16:44:19 article
## 11 2019-10-24 2019-10-25 2019-10-27 16:44:19 article
## 12 2019-10-23 2019-10-25 2019-10-27 16:44:18 article
## 13 2019-10-23 2019-10-25 2019-10-27 16:44:18 article
## 14 2019-10-17 <NA> 2019-10-25 16:44:02 article
## 15 2019-10-17 2019-10-18 2019-10-27 16:44:15 article
## 16 2019-10-17 2019-10-18 2019-10-25 16:44:02 article
## 17 2019-10-17 2019-10-18 2019-10-17 22:28:03 article
## 18 2019-10-17 2019-10-18 2019-10-27 16:44:17 article
## 19 2019-10-17 2019-10-18 2019-10-27 16:44:17 article
## 20 2019-10-17 2019-10-18 2019-10-27 16:44:17 article
## link.url
## 1 http://www.nytimes.com/2019/10/24/movies/synonyms-review.html
## 2 http://www.nytimes.com/2019/10/24/movies/black-and-blue-review.html
## 3 http://www.nytimes.com/2019/10/24/movies/western-stars-review.html
## 4 http://www.nytimes.com/2019/10/24/movies/making-waves-the-art-of-cinematic-sound-review.html
## 5 http://www.nytimes.com/2019/10/24/movies/burning-cane-review.html
## 6 http://www.nytimes.com/2019/10/24/movies/the-kill-team-review.html
## 7 http://www.nytimes.com/2019/10/24/movies/farming-review.html
## 8 http://www.nytimes.com/2019/10/24/movies/the-great-alaskan-race-review.html
## 9 http://www.nytimes.com/2019/10/24/movies/portals-review.html
## 10 http://www.nytimes.com/2019/10/24/movies/the-gallows-act-two-review.html
## 11 http://www.nytimes.com/2019/10/24/movies/the-current-war-review.html
## 12 http://www.nytimes.com/2019/10/23/movies/paradise-hills-review.html
## 13 http://www.nytimes.com/2019/10/23/movies/frankie-review.html
## 14 http://www.nytimes.com/2019/10/17/movies/the-elephant-queen-review.html
## 15 http://www.nytimes.com/2019/10/17/movies/by-the-grace-of-god-review.html
## 16 http://www.nytimes.com/2019/10/17/movies/the-cave-review.html
## 17 http://www.nytimes.com/2019/10/17/movies/wounds-review.html
## 18 http://www.nytimes.com/2019/10/17/movies/jojo-rabbit-review.html
## 19 http://www.nytimes.com/2019/10/17/movies/kinetta-review.html
## 20 http://www.nytimes.com/2019/10/17/movies/maleficent-mistress-of-evil-review.html
## link.suggested_link_text
## 1 Read the New York Times Review of Synonyms
## 2 Read the New York Times Review of Black and Blue
## 3 Read the New York Times Review of Western Stars
## 4 Read the New York Times Review of Making Waves: The Art of Cinematic Sound
## 5 Read the New York Times Review of Burning Cane
## 6 Read the New York Times Review of The Kill Team
## 7 Read the New York Times Review of Farming
## 8 Read the New York Times Review of The Great Alaskan Race
## 9 Read the New York Times Review of Portals
## 10 Read the New York Times Review of The Gallows Act II
## 11 Read the New York Times Review of The Current War: Director's Cut
## 12 Read the New York Times Review of Paradise Hills
## 13 Read the New York Times Review of Frankie
## 14 Read the New York Times Review of The Elephant Queen
## 15 Read the New York Times Review of By the Grace of God
## 16 Read the New York Times Review of The Cave
## 17 Read the New York Times Review of Wounds
## 18 Read the New York Times Review of Jojo Rabbit
## 19 Read the New York Times Review of Kinetta
## 20 Read the New York Times Review of Maleficent: Mistress of Evil
## multimedia.type
## 1 mediumThreeByTwo210
## 2 mediumThreeByTwo210
## 3 mediumThreeByTwo210
## 4 mediumThreeByTwo210
## 5 mediumThreeByTwo210
## 6 mediumThreeByTwo210
## 7 mediumThreeByTwo210
## 8 mediumThreeByTwo210
## 9 mediumThreeByTwo210
## 10 mediumThreeByTwo210
## 11 mediumThreeByTwo210
## 12 mediumThreeByTwo210
## 13 mediumThreeByTwo210
## 14 mediumThreeByTwo210
## 15 mediumThreeByTwo210
## 16 mediumThreeByTwo210
## 17 mediumThreeByTwo210
## 18 mediumThreeByTwo210
## 19 mediumThreeByTwo210
## 20 mediumThreeByTwo210
## multimedia.src
## 1 https://static01.nyt.com/images/2019/10/24/arts/24synonyms/merlin_162980427_b8788cef-d2c4-4e28-a9a5-7a2f1539577a-mediumThreeByTwo210.jpg
## 2 https://static01.nyt.com/images/2019/10/25/arts/24blackandblue/merlin_162979524_8fe68107-5e63-4c42-aab1-e951f9dde0e7-mediumThreeByTwo210.jpg
## 3 https://static01.nyt.com/images/2019/10/24/arts/western1/merlin_162980691_01b11a6f-d4c0-48de-a1a3-bb081a6082d5-mediumThreeByTwo210.jpg
## 4 https://static01.nyt.com/images/2019/10/25/arts/24makingwaves/24makingwaves-mediumThreeByTwo210.jpg
## 5 https://static01.nyt.com/images/2019/10/25/arts/24burning/merlin_162979698_0fef3cbf-1f57-4374-a5d4-8da952532c16-mediumThreeByTwo210.jpg
## 6 https://static01.nyt.com/images/2019/10/24/arts/24killteam/merlin_162980196_c2a146f1-5a88-4e2e-bec6-19dfd36fa254-mediumThreeByTwo210.jpg
## 7 https://static01.nyt.com/images/2019/10/25/arts/24FARMING/merlin_162979812_4a924b7f-40bf-4d89-b781-425e0e7610fd-mediumThreeByTwo210.jpg
## 8 https://static01.nyt.com/images/2019/10/24/arts/24greatalaskan/24greatalaskan-mediumThreeByTwo210.jpg
## 9 https://static01.nyt.com/images/2019/10/22/arts/portals1/portals1-mediumThreeByTwo210.jpg
## 10 https://static01.nyt.com/images/2019/10/22/arts/gallows1/gallows1-mediumThreeByTwo210.jpg
## 11 https://static01.nyt.com/images/2019/10/23/arts/current2/current2-mediumThreeByTwo210.jpg
## 12 https://static01.nyt.com/images/2019/10/25/arts/23paradise-1/merlin_162980316_f2923866-4de0-4164-94b6-f0f202fa4758-mediumThreeByTwo210.jpg
## 13 https://static01.nyt.com/images/2019/10/25/arts/25frankie/merlin_162979869_c60d9411-18eb-430d-be8c-3f5d2fb42983-mediumThreeByTwo210.jpg
## 14 https://static01.nyt.com/images/2019/10/18/arts/17elephantqueen-art/merlin_162491211_576ddd0e-4389-4a2d-8521-3f5c092184ed-mediumThreeByTwo210.jpg
## 15 https://static01.nyt.com/images/2019/10/18/arts/17graceofgod-art/merlin_162489012_de91ad91-3748-445c-b3ea-c3c24e565a96-mediumThreeByTwo210.jpg
## 16 https://static01.nyt.com/images/2019/10/18/arts/17thecave-art/merlin_162490917_4443d34d-2a44-44d8-b04d-673b56d8894a-mediumThreeByTwo210.jpg
## 17 https://static01.nyt.com/images/2019/10/17/arts/17WOUNDS/17WOUNDS-mediumThreeByTwo210.jpg
## 18 https://static01.nyt.com/images/2019/10/17/arts/17jojorabbit/17jojorabbit-mediumThreeByTwo210.jpg
## 19 https://static01.nyt.com/images/2019/10/17/arts/17kinetta/merlin_162581646_1afd1b09-388e-4662-adc6-8655e3bcf70e-mediumThreeByTwo210.jpg
## 20 https://static01.nyt.com/images/2019/10/18/arts/17maleficentpix1/17maleficentpix1-mediumThreeByTwo210.jpg
## multimedia.width multimedia.height
## 1 210 140
## 2 210 140
## 3 210 140
## 4 210 140
## 5 210 140
## 6 210 140
## 7 210 140
## 8 210 140
## 9 210 140
## 10 210 140
## 11 210 140
## 12 210 140
## 13 210 140
## 14 210 140
## 15 210 140
## 16 210 140
## 17 210 140
## 18 210 140
## 19 210 140
## 20 210 140
The dataframe seems to contain 20 cases, each case being a different movie that was recently released. Each case has information on the movie, such as the name of the movie, the release date, the rating of the movie, and a link containing information on the movie. Also there is information on the movie critic reviewing the movie, such as their name, a title for their review, and a short description of the review.
Let’s see how many R-rated movies were reviewed.
Movie_df %>%
filter(str_detect(mpaa_rating, "R"))
## display_title mpaa_rating critics_pick byline
## 1 Black and Blue R 1 A.O. SCOTT
## 2 The Kill Team R 0 BEN KENIGSBERG
## 3 Farming R 0 BEN KENIGSBERG
## 4 The Gallows Act II R 0 GLENN KENNY
## 5 Wounds R 0 HELEN T. VERONGOS
## headline
## 1 ‘Black and Blue’ Review: A Cop Thriller for Our Age of Dread
## 2 ‘The Kill Team’ Review: Bullying on the Battlefield
## 3 ‘Farming’ Review: A Young Life of Self-Loathing
## 4 ‘The Gallows Act II’ Review: The Play’s the Thing (That Kills)
## 5 ‘Wounds’ Review: He Sees Dead People
## summary_short
## 1 Naomie Harris plays a rookie running from bad police officers and drug dealers in Deon Taylor’s violent, astute film.
## 2 Alexander Skarsgard stars in a film based on the murders of Afghan civilians by American soldiers nearly a decade ago.
## 3 Adewale Akinnuoye-Agbaje looks at the impact of a British system that placed the children of African immigrants with Caucasian foster families.
## 4 Life gets a bit too dramatic for a high school drama student in this horror film.
## 5 Armie Hammer plays a New Orleans bartender who quickly loses his friendly veneer when a spooky cellphone takes over his life.
## publication_date opening_date date_updated link.type
## 1 2019-10-24 2019-10-25 2019-10-27 16:44:22 article
## 2 2019-10-24 2019-10-25 2019-10-24 17:56:02 article
## 3 2019-10-24 <NA> 2019-10-27 16:44:21 article
## 4 2019-10-24 2019-10-25 2019-10-27 16:44:19 article
## 5 2019-10-17 2019-10-18 2019-10-17 22:28:03 article
## link.url
## 1 http://www.nytimes.com/2019/10/24/movies/black-and-blue-review.html
## 2 http://www.nytimes.com/2019/10/24/movies/the-kill-team-review.html
## 3 http://www.nytimes.com/2019/10/24/movies/farming-review.html
## 4 http://www.nytimes.com/2019/10/24/movies/the-gallows-act-two-review.html
## 5 http://www.nytimes.com/2019/10/17/movies/wounds-review.html
## link.suggested_link_text multimedia.type
## 1 Read the New York Times Review of Black and Blue mediumThreeByTwo210
## 2 Read the New York Times Review of The Kill Team mediumThreeByTwo210
## 3 Read the New York Times Review of Farming mediumThreeByTwo210
## 4 Read the New York Times Review of The Gallows Act II mediumThreeByTwo210
## 5 Read the New York Times Review of Wounds mediumThreeByTwo210
## multimedia.src
## 1 https://static01.nyt.com/images/2019/10/25/arts/24blackandblue/merlin_162979524_8fe68107-5e63-4c42-aab1-e951f9dde0e7-mediumThreeByTwo210.jpg
## 2 https://static01.nyt.com/images/2019/10/24/arts/24killteam/merlin_162980196_c2a146f1-5a88-4e2e-bec6-19dfd36fa254-mediumThreeByTwo210.jpg
## 3 https://static01.nyt.com/images/2019/10/25/arts/24FARMING/merlin_162979812_4a924b7f-40bf-4d89-b781-425e0e7610fd-mediumThreeByTwo210.jpg
## 4 https://static01.nyt.com/images/2019/10/22/arts/gallows1/gallows1-mediumThreeByTwo210.jpg
## 5 https://static01.nyt.com/images/2019/10/17/arts/17WOUNDS/17WOUNDS-mediumThreeByTwo210.jpg
## multimedia.width multimedia.height
## 1 210 140
## 2 210 140
## 3 210 140
## 4 210 140
## 5 210 140
Looks like out of the 20 movies that were reviewed, 5 of them were R rated movies.