—————————————————————————

Student Name : Sachid Deshmukh

—————————————————————————

1] Library Initialization

library(jsonlite)
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(ggplot2)

2] Read movie critics info

API.URL = "http://api.nytimes.com/svc/movies/v2/reviews/search.json?api-key=ac5b7916e92c4b21926210fbe19e6434&critics-pick=Y"
Movie.Critics <- fromJSON(API.URL)$results

3] Preview resulting data frame and column types

head(Movie.Critics)
##               display_title mpaa_rating critics_pick              byline
## 1                   Burning   Not Rated            1      MANOHLA DARGIS
## 2 A Bread Factory, Part One                        1         BILGE EBIRI
## 3 A Bread Factory, Part Two                        1         BILGE EBIRI
## 4         Monrovia, Indiana                        1          A.O. SCOTT
## 5                    Border           R            1         GLENN KENNY
## 6                  Shirkers                        1 JEANNETTE CATSOULIS
##                                                                     headline
## 1                         Review: In <U+0091>Burning,<U+0092> Love Ignites a Divided World
## 2     Review: In <U+0091>A Bread Factory,<U+0092> Local Artists Face Off Against the World
## 3     Review: In <U+0091>A Bread Factory,<U+0092> Local Artists Face Off Against the World
## 4 Review: <U+0091>Monrovia, Indiana<U+0092> Is a Sharp, Lyrical Look at Small-Town America
## 5                Review: Sniffing Out Guilt in a Strangely Engaging <U+0091>Border<U+0092>
## 6                    Review: In <U+0091>Shirkers,<U+0092> Stolen Footage and Dashed Dreams
##                                                                                                                                                summary_short
## 1                                             The great South Korean director Lee Chang-dong<U+0092>s latest involves three characters subsumed by desire and rage.
## 2 An ambitious, sprawling film about the efforts of a community arts center to survive, <U+0093>A Bread Factory<U+0094> is a major new work by a singular American artist.
## 3 An ambitious, sprawling film about the efforts of a community arts center to survive, <U+0093>A Bread Factory<U+0094> is a major new work by a singular American artist.
## 4                            Frederick Wiseman<U+0092>s visit to Trump country finds that there is more to life than politics, and more to democracy than ideology.
## 5                               The film, adapted from a short story by the writer of <U+0093>Let the Right One In,<U+0094> follows a security guard with an unusual gift.
## 6                               Sandi Tan<U+0092>s captivating documentary about the theft of her first movie by a charismatic con man is both mystery and manhunt.
##   publication_date opening_date        date_updated link.type
## 1       2018-10-25   2018-11-09 2018-10-26 16:44:28   article
## 2       2018-10-25   2018-10-26 2018-10-26 16:44:27   article
## 3       2018-10-25   2018-10-26 2018-10-26 16:44:27   article
## 4       2018-10-25   2018-10-26 2018-10-25 14:32:03   article
## 5       2018-10-25   2018-10-26 2018-10-26 16:44:26   article
## 6       2018-10-25   2018-10-26 2018-10-26 16:44:24   article
##                                                                            link.url
## 1                      http://www.nytimes.com/2018/10/25/movies/burning-review.html
## 2              http://www.nytimes.com/2018/10/25/movies/a-bread-factory-review.html
## 3              http://www.nytimes.com/2018/10/25/movies/a-bread-factory-review.html
## 4 http://www.nytimes.com/2018/10/25/movies/monrovia-indiana-review-documentary.html
## 5                       http://www.nytimes.com/2018/10/25/movies/border-review.html
## 6                     http://www.nytimes.com/2018/10/25/movies/shirkers-review.html
##                                      link.suggested_link_text
## 1                   Read the New York Times Review of Burning
## 2 Read the New York Times Review of A Bread Factory, Part One
## 3 Read the New York Times Review of A Bread Factory, Part Two
## 4         Read the New York Times Review of Monrovia, Indiana
## 5                    Read the New York Times Review of Border
## 6                  Read the New York Times Review of Shirkers
##       multimedia.type
## 1 mediumThreeByTwo210
## 2 mediumThreeByTwo210
## 3 mediumThreeByTwo210
## 4 mediumThreeByTwo210
## 5 mediumThreeByTwo210
## 6 mediumThreeByTwo210
##                                                                                           multimedia.src
## 1 https://static01.nyt.com/images/2018/10/26/arts/26burning-top/26burning-top-mediumThreeByTwo210-v3.jpg
## 2           https://static01.nyt.com/images/2018/10/26/arts/26bread2/26bread2-mediumThreeByTwo210-v2.jpg
## 3           https://static01.nyt.com/images/2018/10/26/arts/26bread2/26bread2-mediumThreeByTwo210-v2.jpg
## 4     https://static01.nyt.com/images/2018/10/26/arts/26monrovia1/26monrovia1-mediumThreeByTwo210-v3.jpg
## 5           https://static01.nyt.com/images/2018/10/26/arts/26border/26border-mediumThreeByTwo210-v3.jpg
## 6            https://static01.nyt.com/images/2018/10/24/arts/shirkers1/shirkers1-mediumThreeByTwo210.jpg
##   multimedia.width multimedia.height
## 1              210               140
## 2              210               140
## 3              210               140
## 4              210               140
## 5              210               140
## 6              210               140
str(Movie.Critics)
## 'data.frame':    20 obs. of  11 variables:
##  $ display_title   : chr  "Burning" "A Bread Factory, Part One" "A Bread Factory, Part Two" "Monrovia, Indiana" ...
##  $ mpaa_rating     : chr  "Not Rated" "" "" "" ...
##  $ critics_pick    : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ byline          : chr  "MANOHLA DARGIS" "BILGE EBIRI" "BILGE EBIRI" "A.O. SCOTT" ...
##  $ headline        : chr  "Review: In <U+0091>Burning,<U+0092> Love Ignites a Divided World""| __truncated__ "Review: In <U+0091>A Bread Factory,<U+0092> Local Artists Face Off Against the World""| __truncated__ "Review: In <U+0091>A Bread Factory,<U+0092> Local Artists Face Off Against the World""| __truncated__ "Review: <U+0091>Monrovia, Indiana<U+0092> Is a Sharp, Lyrical Look at Small-Town America""| __truncated__ ...
##  $ summary_short   : chr  "The great South Korean director Lee Chang-dong<U+0092>s latest involves three characters subsumed by desire and rage.""| __truncated__ "An ambitious, sprawling film about the efforts of a community arts center to survive, <U+0093>A Bread Factory<U+0094> is a major new work by "| __truncated__ "An ambitious, sprawling film about the efforts of a community arts center to survive, <U+0093>A Bread Factory<U+0094> is a major new work by "| __truncated__ "Frederick Wiseman<U+0092>s visit to Trump country finds that there is more to life than politics, and more to democracy than ideology."| __truncated__ ...
##  $ publication_date: chr  "2018-10-25" "2018-10-25" "2018-10-25" "2018-10-25" ...
##  $ opening_date    : chr  "2018-11-09" "2018-10-26" "2018-10-26" "2018-10-26" ...
##  $ date_updated    : chr  "2018-10-26 16:44:28" "2018-10-26 16:44:27" "2018-10-26 16:44:27" "2018-10-25 14:32:03" ...
##  $ link            :'data.frame':    20 obs. of  3 variables:
##   ..$ type               : chr  "article" "article" "article" "article" ...
##   ..$ url                : chr  "http://www.nytimes.com/2018/10/25/movies/burning-review.html" "http://www.nytimes.com/2018/10/25/movies/a-bread-factory-review.html" "http://www.nytimes.com/2018/10/25/movies/a-bread-factory-review.html" "http://www.nytimes.com/2018/10/25/movies/monrovia-indiana-review-documentary.html" ...
##   ..$ suggested_link_text: chr  "Read the New York Times Review of Burning" "Read the New York Times Review of A Bread Factory, Part One" "Read the New York Times Review of A Bread Factory, Part Two" "Read the New York Times Review of Monrovia, Indiana" ...
##  $ multimedia      :'data.frame':    20 obs. of  4 variables:
##   ..$ type  : chr  "mediumThreeByTwo210" "mediumThreeByTwo210" "mediumThreeByTwo210" "mediumThreeByTwo210" ...
##   ..$ src   : chr  "https://static01.nyt.com/images/2018/10/26/arts/26burning-top/26burning-top-mediumThreeByTwo210-v3.jpg" "https://static01.nyt.com/images/2018/10/26/arts/26bread2/26bread2-mediumThreeByTwo210-v2.jpg" "https://static01.nyt.com/images/2018/10/26/arts/26bread2/26bread2-mediumThreeByTwo210-v2.jpg" "https://static01.nyt.com/images/2018/10/26/arts/26monrovia1/26monrovia1-mediumThreeByTwo210-v3.jpg" ...
##   ..$ width : int  210 210 210 210 210 210 210 210 210 210 ...
##   ..$ height: int  140 140 140 140 140 140 140 140 140 140 ...

Resulting DF have 20 rows and 16 columns. Following is the more information on data frame columns

> display_title : Movie Name > mpaa_rating : Movie Rating > critics_pick : Whether critics pick or not > byline : Name of the critics > headline : Headline Info > summary_short : Short summary > publication_date : Date of publication > opening_date : Date of movie opening > date_updated : Updated Date > link.type : Link Type > link.url : Link URL > link.suggested_link_text : Suggested link url > multimedia.type : Type of multimedia > multimedia.src : Source of multimedia > multimedia.width : Width of multimedia > multimedia.height : Height of multimedia

4] Fill null values in rating column

Movie.Critics$mpaa_rating[Movie.Critics$mpaa_rating == ''] <- 'Not Rated'

5] Show bar chart of rating type

Movie.Critics %>%
   
    ggplot(aes(x=mpaa_rating, fill=mpaa_rating)) + geom_bar(position = "dodge") +# plot
    ggtitle("Movie Rating bar plot")

Top most critics reviews are for not rated movies

6] Show bar chart of critics

Movie.Critics %>%
   
    ggplot(aes(x=byline, fill=byline)) + geom_bar(position = "dodge") +# plot
    ggtitle("Critic bar plot")

Top most critics reviews are done by Glenn Kenny. Second largest critics review are done by AO Scott and Jeannette Catsoulis