Table of Contents

  1. Description of Problem
  2. Introduction
  3. Objective of the Problem
  4. Statistical Techniques
  5. Conclusion
  6. References

Description of Problem

This report will provide an exhaustive analysis of the most successful movies in recent years. It will show facts about why these movies become so successful. In these problem we are going to use a data set that contains information for all 45,000 movies listed in the Full MovieLens Dataset. The dataset consists of movies released on or before July 2017.

Introduction .

In today’s entertainment industry, the search for a winning formula for film has become a multifaceted puzzle for production giants. Amidst the proliferation of content on social media and streaming platforms, traditional indicators of success have undergone a seismic shift, presenting a labyrinthine landscape to navigate. As a Strategy and Insights Analyst tasked with guiding the course of a leading film studio, the mission is crystal clear: uncover the elusive ingredients that distinguish cinematic triumphs from their less prominent counterparts. Armed with a rich tapestry of data housed in the “film analytics” repository, our approach combines cutting-edge analytical techniques with intuitive exploration.

Objective of the Problem .

The objectives that the report inten to resolve are the following:

  • Unravel the critical determinants influencing the success or failure of a film.
  • Employ advanced data refinement techniques to uphold the accuracy and trustworthiness of the analyzed information.
  • Employ a diverse range of analytical methodologies, including scatter plots, box plots, and regression analysis, to gain deeper insights into the underlying trends and dynamics within the dataset.
  • Probe the intricate relationships and correlations between various variables to uncover the key drivers of success within the film industry.
  • Formulate strategic directives tailored for major film production companies, informed by the revelations and deductions derived from the data analysis.

Beginning of Data Cleaning .

##Import libraries and main dataset

## 
## 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
## 
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
## 
##     date, intersect, setdiff, union
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
## Warning: One or more parsing issues, call `problems()` on your data frame for details,
## e.g.:
##   dat <- vroom(...)
##   problems(dat)
## Rows: 45466 Columns: 24
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (14): belongs_to_collection, genres, homepage, imdb_id, original_langua...
## dbl   (7): budget, id, popularity, revenue, runtime, vote_average, vote_count
## lgl   (2): adult, video
## date  (1): release_date
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

##Revise dataset, check for any inconsistencies

## Rows: 45,466
## Columns: 24
## $ adult                 <lgl> FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,…
## $ belongs_to_collection <chr> "{'id': 10194, 'name': 'Toy Story Collection', '…
## $ budget                <dbl> 30000000, 65000000, 0, 16000000, 0, 60000000, 58…
## $ genres                <chr> "[{'id': 16, 'name': 'Animation'}, {'id': 35, 'n…
## $ homepage              <chr> "http://toystory.disney.com/toy-story", NA, NA, …
## $ id                    <dbl> 862, 8844, 15602, 31357, 11862, 949, 11860, 4532…
## $ imdb_id               <chr> "tt0114709", "tt0113497", "tt0113228", "tt011488…
## $ original_language     <chr> "en", "en", "en", "en", "en", "en", "en", "en", …
## $ original_title        <chr> "Toy Story", "Jumanji", "Grumpier Old Men", "Wai…
## $ overview              <chr> "Led by Woody, Andy's toys live happily in his r…
## $ popularity            <dbl> 21.946943, 17.015539, 11.712900, 3.859495, 8.387…
## $ poster_path           <chr> "/rhIRbceoE9lR4veEXuwCC2wARtG.jpg", "/vzmL6fP7aP…
## $ production_companies  <chr> "[{'name': 'Pixar Animation Studios', 'id': 3}]"…
## $ production_countries  <chr> "[{'iso_3166_1': 'US', 'name': 'United States of…
## $ release_date          <date> 1995-10-30, 1995-12-15, 1995-12-22, 1995-12-22,…
## $ revenue               <dbl> 373554033, 262797249, 0, 81452156, 76578911, 187…
## $ runtime               <dbl> 81, 104, 101, 127, 106, 170, 127, 97, 106, 130, …
## $ spoken_languages      <chr> "[{'iso_639_1': 'en', 'name': 'English'}]", "[{'…
## $ status                <chr> "Released", "Released", "Released", "Released", …
## $ tagline               <chr> NA, "Roll the dice and unleash the excitement!",…
## $ title                 <chr> "Toy Story", "Jumanji", "Grumpier Old Men", "Wai…
## $ video                 <lgl> FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,…
## $ vote_average          <dbl> 7.7, 6.9, 6.5, 6.1, 5.7, 7.7, 6.2, 5.4, 5.5, 6.6…
## $ vote_count            <dbl> 5415, 2413, 92, 34, 173, 1886, 141, 45, 174, 119…

##Drop irrelevant columns

## # A tibble: 6 × 21
##   adult belongs_to_collection      budget genres    id imdb_id original_language
##   <lgl> <chr>                       <dbl> <chr>  <dbl> <chr>   <chr>            
## 1 FALSE {'id': 10194, 'name': 'To…  3  e7 [{'id…   862 tt0114… en               
## 2 FALSE <NA>                        6.5e7 [{'id…  8844 tt0113… en               
## 3 FALSE {'id': 119050, 'name': 'G…  0     [{'id… 15602 tt0113… en               
## 4 FALSE <NA>                        1.6e7 [{'id… 31357 tt0114… en               
## 5 FALSE {'id': 96871, 'name': 'Fa…  0     [{'id… 11862 tt0113… en               
## 6 FALSE <NA>                        6  e7 [{'id…   949 tt0113… en               
## # ℹ 14 more variables: original_title <chr>, overview <chr>, popularity <dbl>,
## #   production_companies <chr>, production_countries <chr>,
## #   release_date <date>, revenue <dbl>, runtime <dbl>, spoken_languages <chr>,
## #   status <chr>, tagline <chr>, title <chr>, vote_average <dbl>,
## #   vote_count <dbl>

##Identify and drop duplicates

## [1] 45466
## # A tibble: 32 × 21
##    adult belongs_to_collection   budget genres      id imdb_id original_language
##    <lgl> <chr>                    <dbl> <chr>    <dbl> <chr>   <chr>            
##  1 FALSE <NA>                         0 [{'id'… 105045 tt0111… de               
##  2 FALSE <NA>                         0 [{'id'…   5511 tt0062… fr               
##  3 FALSE <NA>                         0 [{'id'…  23305 tt0295… en               
##  4 FALSE <NA>                   1600000 [{'id'…  14788 tt0454… en               
##  5 FALSE <NA>                         0 [{'id'… 141971 tt1180… fi               
##  6 FALSE <NA>                         4 [{'id'…  22649 tt0022… en               
##  7 FALSE <NA>                      2500 [{'id'…  13209 tt0499… fa               
##  8 FALSE <NA>                         0 [{'id'… 141971 tt1180… fi               
##  9 FALSE <NA>                  40000000 [{'id'…  77221 tt1701… en               
## 10 FALSE <NA>                         0 [{'id'… 109962 tt0082… en               
## # ℹ 22 more rows
## # ℹ 14 more variables: original_title <chr>, overview <chr>, popularity <dbl>,
## #   production_companies <chr>, production_countries <chr>,
## #   release_date <date>, revenue <dbl>, runtime <dbl>, spoken_languages <chr>,
## #   status <chr>, tagline <chr>, title <chr>, vote_average <dbl>,
## #   vote_count <dbl>
## [1] 45434

##Genres Column

##       V1                 V2                 V3           
##  Length:45434       Length:45434       Length:45434      
##  Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character
##     genre1             genre2             genre3         
##  Length:45434       Length:45434       Length:45434      
##  Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character
##            genre1             genre2                    genre3     
##    Drama      :11953             :16994                    :31465  
##    Comedy     : 8816     Drama   : 6302     Thriller       : 2234  
##    Action     : 4487     Comedy  : 3263     Romance        : 2044  
##    Documentary: 3413     Romance : 2857     Drama          : 1675  
##    Horror     : 2619     Thriller: 2523     Comedy         :  911  
##               : 2442     Action  : 1546     Science Fiction:  870  
##  (Other)      :11704   (Other)   :11949   (Other)          : 6235
##               genre1     n
## 1              Drama 11953
## 2             Comedy  8816
## 3             Action  4487
## 4        Documentary  3413
## 5             Horror  2619
## 6                     2442
## 7              Crime  1684
## 8           Thriller  1663
## 9          Adventure  1509
## 10           Romance  1191
## 11         Animation  1124
## 12           Fantasy   703
## 13   Science Fiction   647
## 14           Mystery   554
## 15            Family   524
## 16             Music   487
## 17           Western   451
## 18          TV Movie   390
## 19               War   379
## 20           History   279
## 21           Foreign   118
## 22    11176     name     1
##               genre2     n
## 1                    16994
## 2              Drama  6302
## 3             Comedy  3263
## 4            Romance  2857
## 5           Thriller  2523
## 6             Action  1546
## 7              Crime  1428
## 8          Adventure  1414
## 9             Horror  1398
## 10            Family  1109
## 11   Science Fiction   999
## 12           Mystery   771
## 13           Foreign   768
## 14           Fantasy   764
## 15             Music   741
## 16           History   640
## 17         Animation   618
## 18       Documentary   469
## 19               War   368
## 20           Western   304
## 21          TV Movie   157
## 22    11602     name     1
##               genre3     n
## 1                    31465
## 2           Thriller  2234
## 3            Romance  2044
## 4              Drama  1675
## 5             Comedy   911
## 6    Science Fiction   870
## 7              Crime   852
## 8            Mystery   773
## 9             Family   756
## 10           Fantasy   539
## 11            Horror   513
## 12            Action   451
## 13         Adventure   422
## 14           Foreign   421
## 15               War   388
## 16           History   348
## 17             Music   269
## 18         Animation   171
## 19           Western   168
## 20          TV Movie   125
## 21       Documentary    38
## 22             29812     1
##   adult
## 1 FALSE
## 2 FALSE
## 3 FALSE
## 4 FALSE
## 5 FALSE
## 6 FALSE
##                                                                                                                                             belongs_to_collection
## 1           {'id': 10194, 'name': 'Toy Story Collection', 'poster_path': '/7G9915LfUQ2lVfwMEEhDsn3kT4B.jpg', 'backdrop_path': '/9FBwqcd9IRruEDUrTdcaafOMKUq.jpg'}
## 2                                                                                                                                                            <NA>
## 3     {'id': 119050, 'name': 'Grumpy Old Men Collection', 'poster_path': '/nLvUdqgPgm3F85NMCii9gVFUcet.jpg', 'backdrop_path': '/hypTnLot2z8wpFS7qwsQHW1uV8u.jpg'}
## 4                                                                                                                                                            <NA>
## 5 {'id': 96871, 'name': 'Father of the Bride Collection', 'poster_path': '/nts4iOmNnq7GNicycMJ9pSAn204.jpg', 'backdrop_path': '/7qwE57OVZmMJChBpLEbJEmzUydk.jpg'}
## 6                                                                                                                                                            <NA>
##    budget
## 1 3.0e+07
## 2 6.5e+07
## 3 0.0e+00
## 4 1.6e+07
## 5 0.0e+00
## 6 6.0e+07
##                                                                                                                     genres
## 1                         [{'id': 16, 'name': 'Animation'}, {'id': 35, 'name': 'Comedy'}, {'id': 10751, 'name': 'Family'}]
## 2                        [{'id': 12, 'name': 'Adventure'}, {'id': 14, 'name': 'Fantasy'}, {'id': 10751, 'name': 'Family'}]
## 3                                                         [{'id': 10749, 'name': 'Romance'}, {'id': 35, 'name': 'Comedy'}]
## 4                            [{'id': 35, 'name': 'Comedy'}, {'id': 18, 'name': 'Drama'}, {'id': 10749, 'name': 'Romance'}]
## 5                                                                                           [{'id': 35, 'name': 'Comedy'}]
## 6 [{'id': 28, 'name': 'Action'}, {'id': 80, 'name': 'Crime'}, {'id': 18, 'name': 'Drama'}, {'id': 53, 'name': 'Thriller'}]
##      id   imdb_id original_language              original_title
## 1   862 tt0114709                en                   Toy Story
## 2  8844 tt0113497                en                     Jumanji
## 3 15602 tt0113228                en            Grumpier Old Men
## 4 31357 tt0114885                en           Waiting to Exhale
## 5 11862 tt0113041                en Father of the Bride Part II
## 6   949 tt0113277                en                        Heat
##                                                                                                                                                                                                                                                                                                                                                                                                      overview
## 1                                                                                             Led by Woody, Andy's toys live happily in his room until Andy's birthday brings Buzz Lightyear onto the scene. Afraid of losing his place in Andy's heart, Woody plots against Buzz. But when circumstances separate Buzz and Woody from their owner, the duo eventually learns to put aside their differences.
## 2 When siblings Judy and Peter discover an enchanted board game that opens the door to a magical world, they unwittingly invite Alan -- an adult who's been trapped inside the game for 26 years -- into their living room. Alan's only hope for freedom is to finish the game, which proves risky as all three find themselves running from giant rhinoceroses, evil monkeys and other terrifying creatures.
## 3                                                                     A family wedding reignites the ancient feud between next-door neighbors and fishing buddies John and Max. Meanwhile, a sultry Italian divorcée opens a restaurant at the local bait shop, alarming the locals who worry she'll scare the fish away. But she's less interested in seafood than she is in cooking up a hot time with Max.
## 4                                                                                                                              Cheated on, mistreated and stepped on, the women are holding their breath, waiting for the elusive "good man" to break a string of less-than-stellar lovers. Friends and confidants Vannah, Bernie, Glo and Robin talk it all out, determined to find a better way to breathe.
## 5                                                                              Just when George Banks has recovered from his daughter's wedding, he receives the news that she's pregnant ... and that George's wife, Nina, is expecting too. He was planning on selling their home, but that's a plan that -- like George -- will have to change with the arrival of both a grandchild and a kid of his own.
## 6                                                             Obsessive master thief, Neil McCauley leads a top-notch crew on various insane heists throughout Los Angeles while a mentally unstable detective, Vincent Hanna pursues him without rest. Each man recognizes and respects the ability and the dedication of the other even though they are aware their cat-and-mouse game may end in violence.
##   popularity
## 1  21.946943
## 2  17.015539
## 3  11.712900
## 4   3.859495
## 5   8.387519
## 6  17.924927
##                                                                                                                  production_companies
## 1                                                                                      [{'name': 'Pixar Animation Studios', 'id': 3}]
## 2 [{'name': 'TriStar Pictures', 'id': 559}, {'name': 'Teitler Film', 'id': 2550}, {'name': 'Interscope Communications', 'id': 10201}]
## 3                                                     [{'name': 'Warner Bros.', 'id': 6194}, {'name': 'Lancaster Gate', 'id': 19464}]
## 4                                                                     [{'name': 'Twentieth Century Fox Film Corporation', 'id': 306}]
## 5                                        [{'name': 'Sandollar Productions', 'id': 5842}, {'name': 'Touchstone Pictures', 'id': 9195}]
## 6             [{'name': 'Regency Enterprises', 'id': 508}, {'name': 'Forward Pass', 'id': 675}, {'name': 'Warner Bros.', 'id': 6194}]
##                                         production_countries release_date
## 1 [{'iso_3166_1': 'US', 'name': 'United States of America'}]   1995-10-30
## 2 [{'iso_3166_1': 'US', 'name': 'United States of America'}]   1995-12-15
## 3 [{'iso_3166_1': 'US', 'name': 'United States of America'}]   1995-12-22
## 4 [{'iso_3166_1': 'US', 'name': 'United States of America'}]   1995-12-22
## 5 [{'iso_3166_1': 'US', 'name': 'United States of America'}]   1995-02-10
## 6 [{'iso_3166_1': 'US', 'name': 'United States of America'}]   1995-12-15
##     revenue runtime
## 1 373554033      81
## 2 262797249     104
## 3         0     101
## 4  81452156     127
## 5  76578911     106
## 6 187436818     170
##                                                                    spoken_languages
## 1                                          [{'iso_639_1': 'en', 'name': 'English'}]
## 2 [{'iso_639_1': 'en', 'name': 'English'}, {'iso_639_1': 'fr', 'name': 'Français'}]
## 3                                          [{'iso_639_1': 'en', 'name': 'English'}]
## 4                                          [{'iso_639_1': 'en', 'name': 'English'}]
## 5                                          [{'iso_639_1': 'en', 'name': 'English'}]
## 6  [{'iso_639_1': 'en', 'name': 'English'}, {'iso_639_1': 'es', 'name': 'Español'}]
##     status
## 1 Released
## 2 Released
## 3 Released
## 4 Released
## 5 Released
## 6 Released
##                                                                          tagline
## 1                                                                           <NA>
## 2                                      Roll the dice and unleash the excitement!
## 3                           Still Yelling. Still Fighting. Still Ready for Love.
## 4 Friends are the people who let you be yourself... and never let you forget it.
## 5 Just When His World Is Back To Normal... He's In For The Surprise Of His Life!
## 6                                                       A Los Angeles Crime Saga
##                         title vote_average vote_count
## 1                   Toy Story          7.7       5415
## 2                     Jumanji          6.9       2413
## 3            Grumpier Old Men          6.5         92
## 4           Waiting to Exhale          6.1         34
## 5 Father of the Bride Part II          5.7        173
## 6                        Heat          7.7       1886
##                                                                                                              genres_string
## 1                         [{'id': 16, 'name': 'Animation'}, {'id': 35, 'name': 'Comedy'}, {'id': 10751, 'name': 'Family'}]
## 2                        [{'id': 12, 'name': 'Adventure'}, {'id': 14, 'name': 'Fantasy'}, {'id': 10751, 'name': 'Family'}]
## 3                                                         [{'id': 10749, 'name': 'Romance'}, {'id': 35, 'name': 'Comedy'}]
## 4                            [{'id': 35, 'name': 'Comedy'}, {'id': 18, 'name': 'Drama'}, {'id': 10749, 'name': 'Romance'}]
## 5                                                                                           [{'id': 35, 'name': 'Comedy'}]
## 6 [{'id': 28, 'name': 'Action'}, {'id': 80, 'name': 'Crime'}, {'id': 18, 'name': 'Drama'}, {'id': 53, 'name': 'Thriller'}]
##        genre1    genre2    genre3
## 1   Animation    Comedy    Family
## 2   Adventure   Fantasy    Family
## 3     Romance    Comedy          
## 4      Comedy     Drama   Romance
## 5      Comedy                    
## 6      Action     Crime     Drama

##Production Companies Column

##   adult
## 1 FALSE
## 2 FALSE
## 3 FALSE
## 4 FALSE
## 5 FALSE
## 6 FALSE
##                                                                                                                                             belongs_to_collection
## 1           {'id': 10194, 'name': 'Toy Story Collection', 'poster_path': '/7G9915LfUQ2lVfwMEEhDsn3kT4B.jpg', 'backdrop_path': '/9FBwqcd9IRruEDUrTdcaafOMKUq.jpg'}
## 2                                                                                                                                                            <NA>
## 3     {'id': 119050, 'name': 'Grumpy Old Men Collection', 'poster_path': '/nLvUdqgPgm3F85NMCii9gVFUcet.jpg', 'backdrop_path': '/hypTnLot2z8wpFS7qwsQHW1uV8u.jpg'}
## 4                                                                                                                                                            <NA>
## 5 {'id': 96871, 'name': 'Father of the Bride Collection', 'poster_path': '/nts4iOmNnq7GNicycMJ9pSAn204.jpg', 'backdrop_path': '/7qwE57OVZmMJChBpLEbJEmzUydk.jpg'}
## 6                                                                                                                                                            <NA>
##    budget
## 1 3.0e+07
## 2 6.5e+07
## 3 0.0e+00
## 4 1.6e+07
## 5 0.0e+00
## 6 6.0e+07
##                                                                                                                     genres
## 1                         [{'id': 16, 'name': 'Animation'}, {'id': 35, 'name': 'Comedy'}, {'id': 10751, 'name': 'Family'}]
## 2                        [{'id': 12, 'name': 'Adventure'}, {'id': 14, 'name': 'Fantasy'}, {'id': 10751, 'name': 'Family'}]
## 3                                                         [{'id': 10749, 'name': 'Romance'}, {'id': 35, 'name': 'Comedy'}]
## 4                            [{'id': 35, 'name': 'Comedy'}, {'id': 18, 'name': 'Drama'}, {'id': 10749, 'name': 'Romance'}]
## 5                                                                                           [{'id': 35, 'name': 'Comedy'}]
## 6 [{'id': 28, 'name': 'Action'}, {'id': 80, 'name': 'Crime'}, {'id': 18, 'name': 'Drama'}, {'id': 53, 'name': 'Thriller'}]
##      id   imdb_id original_language              original_title
## 1   862 tt0114709                en                   Toy Story
## 2  8844 tt0113497                en                     Jumanji
## 3 15602 tt0113228                en            Grumpier Old Men
## 4 31357 tt0114885                en           Waiting to Exhale
## 5 11862 tt0113041                en Father of the Bride Part II
## 6   949 tt0113277                en                        Heat
##                                                                                                                                                                                                                                                                                                                                                                                                      overview
## 1                                                                                             Led by Woody, Andy's toys live happily in his room until Andy's birthday brings Buzz Lightyear onto the scene. Afraid of losing his place in Andy's heart, Woody plots against Buzz. But when circumstances separate Buzz and Woody from their owner, the duo eventually learns to put aside their differences.
## 2 When siblings Judy and Peter discover an enchanted board game that opens the door to a magical world, they unwittingly invite Alan -- an adult who's been trapped inside the game for 26 years -- into their living room. Alan's only hope for freedom is to finish the game, which proves risky as all three find themselves running from giant rhinoceroses, evil monkeys and other terrifying creatures.
## 3                                                                     A family wedding reignites the ancient feud between next-door neighbors and fishing buddies John and Max. Meanwhile, a sultry Italian divorcée opens a restaurant at the local bait shop, alarming the locals who worry she'll scare the fish away. But she's less interested in seafood than she is in cooking up a hot time with Max.
## 4                                                                                                                              Cheated on, mistreated and stepped on, the women are holding their breath, waiting for the elusive "good man" to break a string of less-than-stellar lovers. Friends and confidants Vannah, Bernie, Glo and Robin talk it all out, determined to find a better way to breathe.
## 5                                                                              Just when George Banks has recovered from his daughter's wedding, he receives the news that she's pregnant ... and that George's wife, Nina, is expecting too. He was planning on selling their home, but that's a plan that -- like George -- will have to change with the arrival of both a grandchild and a kid of his own.
## 6                                                             Obsessive master thief, Neil McCauley leads a top-notch crew on various insane heists throughout Los Angeles while a mentally unstable detective, Vincent Hanna pursues him without rest. Each man recognizes and respects the ability and the dedication of the other even though they are aware their cat-and-mouse game may end in violence.
##   popularity
## 1  21.946943
## 2  17.015539
## 3  11.712900
## 4   3.859495
## 5   8.387519
## 6  17.924927
##                                                                                                                  production_companies
## 1                                                                                      [{'name': 'Pixar Animation Studios', 'id': 3}]
## 2 [{'name': 'TriStar Pictures', 'id': 559}, {'name': 'Teitler Film', 'id': 2550}, {'name': 'Interscope Communications', 'id': 10201}]
## 3                                                     [{'name': 'Warner Bros.', 'id': 6194}, {'name': 'Lancaster Gate', 'id': 19464}]
## 4                                                                     [{'name': 'Twentieth Century Fox Film Corporation', 'id': 306}]
## 5                                        [{'name': 'Sandollar Productions', 'id': 5842}, {'name': 'Touchstone Pictures', 'id': 9195}]
## 6             [{'name': 'Regency Enterprises', 'id': 508}, {'name': 'Forward Pass', 'id': 675}, {'name': 'Warner Bros.', 'id': 6194}]
##                                         production_countries release_date
## 1 [{'iso_3166_1': 'US', 'name': 'United States of America'}]   1995-10-30
## 2 [{'iso_3166_1': 'US', 'name': 'United States of America'}]   1995-12-15
## 3 [{'iso_3166_1': 'US', 'name': 'United States of America'}]   1995-12-22
## 4 [{'iso_3166_1': 'US', 'name': 'United States of America'}]   1995-12-22
## 5 [{'iso_3166_1': 'US', 'name': 'United States of America'}]   1995-02-10
## 6 [{'iso_3166_1': 'US', 'name': 'United States of America'}]   1995-12-15
##     revenue runtime
## 1 373554033      81
## 2 262797249     104
## 3         0     101
## 4  81452156     127
## 5  76578911     106
## 6 187436818     170
##                                                                    spoken_languages
## 1                                          [{'iso_639_1': 'en', 'name': 'English'}]
## 2 [{'iso_639_1': 'en', 'name': 'English'}, {'iso_639_1': 'fr', 'name': 'Français'}]
## 3                                          [{'iso_639_1': 'en', 'name': 'English'}]
## 4                                          [{'iso_639_1': 'en', 'name': 'English'}]
## 5                                          [{'iso_639_1': 'en', 'name': 'English'}]
## 6  [{'iso_639_1': 'en', 'name': 'English'}, {'iso_639_1': 'es', 'name': 'Español'}]
##     status
## 1 Released
## 2 Released
## 3 Released
## 4 Released
## 5 Released
## 6 Released
##                                                                          tagline
## 1                                                                           <NA>
## 2                                      Roll the dice and unleash the excitement!
## 3                           Still Yelling. Still Fighting. Still Ready for Love.
## 4 Friends are the people who let you be yourself... and never let you forget it.
## 5 Just When His World Is Back To Normal... He's In For The Surprise Of His Life!
## 6                                                       A Los Angeles Crime Saga
##                         title vote_average vote_count
## 1                   Toy Story          7.7       5415
## 2                     Jumanji          6.9       2413
## 3            Grumpier Old Men          6.5         92
## 4           Waiting to Exhale          6.1         34
## 5 Father of the Bride Part II          5.7        173
## 6                        Heat          7.7       1886
##                                                                                                              genres_string
## 1                         [{'id': 16, 'name': 'Animation'}, {'id': 35, 'name': 'Comedy'}, {'id': 10751, 'name': 'Family'}]
## 2                        [{'id': 12, 'name': 'Adventure'}, {'id': 14, 'name': 'Fantasy'}, {'id': 10751, 'name': 'Family'}]
## 3                                                         [{'id': 10749, 'name': 'Romance'}, {'id': 35, 'name': 'Comedy'}]
## 4                            [{'id': 35, 'name': 'Comedy'}, {'id': 18, 'name': 'Drama'}, {'id': 10749, 'name': 'Romance'}]
## 5                                                                                           [{'id': 35, 'name': 'Comedy'}]
## 6 [{'id': 28, 'name': 'Action'}, {'id': 80, 'name': 'Crime'}, {'id': 18, 'name': 'Drama'}, {'id': 53, 'name': 'Thriller'}]
##        genre1    genre2    genre3 number_of_companies
## 1   Animation    Comedy    Family                   1
## 2   Adventure   Fantasy    Family                   3
## 3     Romance    Comedy                             2
## 4      Comedy     Drama   Romance                   1
## 5      Comedy                                       2
## 6      Action     Crime     Drama                   3

##Identify nulls

##                 adult belongs_to_collection                budget 
##                     1                 40945                     1 
##                genres                    id               imdb_id 
##                     0                     1                    17 
##     original_language        original_title              overview 
##                    11                     0                   959 
##            popularity  production_companies  production_countries 
##                     4                     3                     3 
##          release_date               revenue               runtime 
##                    88                     4                   261 
##      spoken_languages                status               tagline 
##                     4                    85                 25034 
##                 title          vote_average            vote_count 
##                     4                     4                     4 
##         genres_string                genre1                genre2 
##                     0                     0                     0 
##                genre3   number_of_companies 
##                     0                     3

##Belongs to collection and Tagline column

##Languages column(s)

##   adult franchise  budget
## 1 FALSE         1 3.0e+07
## 2 FALSE         0 6.5e+07
## 3 FALSE         1 0.0e+00
## 4 FALSE         0 1.6e+07
## 5 FALSE         1 0.0e+00
## 6 FALSE         0 6.0e+07
##                                                                                                                     genres
## 1                         [{'id': 16, 'name': 'Animation'}, {'id': 35, 'name': 'Comedy'}, {'id': 10751, 'name': 'Family'}]
## 2                        [{'id': 12, 'name': 'Adventure'}, {'id': 14, 'name': 'Fantasy'}, {'id': 10751, 'name': 'Family'}]
## 3                                                         [{'id': 10749, 'name': 'Romance'}, {'id': 35, 'name': 'Comedy'}]
## 4                            [{'id': 35, 'name': 'Comedy'}, {'id': 18, 'name': 'Drama'}, {'id': 10749, 'name': 'Romance'}]
## 5                                                                                           [{'id': 35, 'name': 'Comedy'}]
## 6 [{'id': 28, 'name': 'Action'}, {'id': 80, 'name': 'Crime'}, {'id': 18, 'name': 'Drama'}, {'id': 53, 'name': 'Thriller'}]
##      id   imdb_id original_language              original_title
## 1   862 tt0114709                en                   Toy Story
## 2  8844 tt0113497                en                     Jumanji
## 3 15602 tt0113228                en            Grumpier Old Men
## 4 31357 tt0114885                en           Waiting to Exhale
## 5 11862 tt0113041                en Father of the Bride Part II
## 6   949 tt0113277                en                        Heat
##                                                                                                                                                                                                                                                                                                                                                                                                      overview
## 1                                                                                             Led by Woody, Andy's toys live happily in his room until Andy's birthday brings Buzz Lightyear onto the scene. Afraid of losing his place in Andy's heart, Woody plots against Buzz. But when circumstances separate Buzz and Woody from their owner, the duo eventually learns to put aside their differences.
## 2 When siblings Judy and Peter discover an enchanted board game that opens the door to a magical world, they unwittingly invite Alan -- an adult who's been trapped inside the game for 26 years -- into their living room. Alan's only hope for freedom is to finish the game, which proves risky as all three find themselves running from giant rhinoceroses, evil monkeys and other terrifying creatures.
## 3                                                                     A family wedding reignites the ancient feud between next-door neighbors and fishing buddies John and Max. Meanwhile, a sultry Italian divorcée opens a restaurant at the local bait shop, alarming the locals who worry she'll scare the fish away. But she's less interested in seafood than she is in cooking up a hot time with Max.
## 4                                                                                                                              Cheated on, mistreated and stepped on, the women are holding their breath, waiting for the elusive "good man" to break a string of less-than-stellar lovers. Friends and confidants Vannah, Bernie, Glo and Robin talk it all out, determined to find a better way to breathe.
## 5                                                                              Just when George Banks has recovered from his daughter's wedding, he receives the news that she's pregnant ... and that George's wife, Nina, is expecting too. He was planning on selling their home, but that's a plan that -- like George -- will have to change with the arrival of both a grandchild and a kid of his own.
## 6                                                             Obsessive master thief, Neil McCauley leads a top-notch crew on various insane heists throughout Los Angeles while a mentally unstable detective, Vincent Hanna pursues him without rest. Each man recognizes and respects the ability and the dedication of the other even though they are aware their cat-and-mouse game may end in violence.
##   popularity
## 1  21.946943
## 2  17.015539
## 3  11.712900
## 4   3.859495
## 5   8.387519
## 6  17.924927
##                                                                                                                  production_companies
## 1                                                                                      [{'name': 'Pixar Animation Studios', 'id': 3}]
## 2 [{'name': 'TriStar Pictures', 'id': 559}, {'name': 'Teitler Film', 'id': 2550}, {'name': 'Interscope Communications', 'id': 10201}]
## 3                                                     [{'name': 'Warner Bros.', 'id': 6194}, {'name': 'Lancaster Gate', 'id': 19464}]
## 4                                                                     [{'name': 'Twentieth Century Fox Film Corporation', 'id': 306}]
## 5                                        [{'name': 'Sandollar Productions', 'id': 5842}, {'name': 'Touchstone Pictures', 'id': 9195}]
## 6             [{'name': 'Regency Enterprises', 'id': 508}, {'name': 'Forward Pass', 'id': 675}, {'name': 'Warner Bros.', 'id': 6194}]
##                                         production_countries release_date
## 1 [{'iso_3166_1': 'US', 'name': 'United States of America'}]   1995-10-30
## 2 [{'iso_3166_1': 'US', 'name': 'United States of America'}]   1995-12-15
## 3 [{'iso_3166_1': 'US', 'name': 'United States of America'}]   1995-12-22
## 4 [{'iso_3166_1': 'US', 'name': 'United States of America'}]   1995-12-22
## 5 [{'iso_3166_1': 'US', 'name': 'United States of America'}]   1995-02-10
## 6 [{'iso_3166_1': 'US', 'name': 'United States of America'}]   1995-12-15
##     revenue runtime
## 1 373554033      81
## 2 262797249     104
## 3         0     101
## 4  81452156     127
## 5  76578911     106
## 6 187436818     170
##                                                                    spoken_languages
## 1                                          [{'iso_639_1': 'en', 'name': 'English'}]
## 2 [{'iso_639_1': 'en', 'name': 'English'}, {'iso_639_1': 'fr', 'name': 'Français'}]
## 3                                          [{'iso_639_1': 'en', 'name': 'English'}]
## 4                                          [{'iso_639_1': 'en', 'name': 'English'}]
## 5                                          [{'iso_639_1': 'en', 'name': 'English'}]
## 6  [{'iso_639_1': 'en', 'name': 'English'}, {'iso_639_1': 'es', 'name': 'Español'}]
##     status tagline                       title vote_average vote_count
## 1 Released       0                   Toy Story          7.7       5415
## 2 Released       1                     Jumanji          6.9       2413
## 3 Released       1            Grumpier Old Men          6.5         92
## 4 Released       1           Waiting to Exhale          6.1         34
## 5 Released       1 Father of the Bride Part II          5.7        173
## 6 Released       1                        Heat          7.7       1886
##                                                                                                              genres_string
## 1                         [{'id': 16, 'name': 'Animation'}, {'id': 35, 'name': 'Comedy'}, {'id': 10751, 'name': 'Family'}]
## 2                        [{'id': 12, 'name': 'Adventure'}, {'id': 14, 'name': 'Fantasy'}, {'id': 10751, 'name': 'Family'}]
## 3                                                         [{'id': 10749, 'name': 'Romance'}, {'id': 35, 'name': 'Comedy'}]
## 4                            [{'id': 35, 'name': 'Comedy'}, {'id': 18, 'name': 'Drama'}, {'id': 10749, 'name': 'Romance'}]
## 5                                                                                           [{'id': 35, 'name': 'Comedy'}]
## 6 [{'id': 28, 'name': 'Action'}, {'id': 80, 'name': 'Crime'}, {'id': 18, 'name': 'Drama'}, {'id': 53, 'name': 'Thriller'}]
##        genre1    genre2    genre3 number_of_companies spoken_languages_count
## 1   Animation    Comedy    Family                   1                      1
## 2   Adventure   Fantasy    Family                   3                      2
## 3     Romance    Comedy                             2                      1
## 4      Comedy     Drama   Romance                   1                      1
## 5      Comedy                                       2                      1
## 6      Action     Crime     Drama                   3                      2
##   og_language
## 1     English
## 2     English
## 3     English
## 4     English
## 5     English
## 6     English

##Remove repeated columns

##   adult franchise  budget    id   imdb_id              original_title
## 1 FALSE         1 3.0e+07   862 tt0114709                   Toy Story
## 2 FALSE         0 6.5e+07  8844 tt0113497                     Jumanji
## 3 FALSE         1 0.0e+00 15602 tt0113228            Grumpier Old Men
## 4 FALSE         0 1.6e+07 31357 tt0114885           Waiting to Exhale
## 5 FALSE         1 0.0e+00 11862 tt0113041 Father of the Bride Part II
## 6 FALSE         0 6.0e+07   949 tt0113277                        Heat
##                                                                                                                                                                                                                                                                                                                                                                                                      overview
## 1                                                                                             Led by Woody, Andy's toys live happily in his room until Andy's birthday brings Buzz Lightyear onto the scene. Afraid of losing his place in Andy's heart, Woody plots against Buzz. But when circumstances separate Buzz and Woody from their owner, the duo eventually learns to put aside their differences.
## 2 When siblings Judy and Peter discover an enchanted board game that opens the door to a magical world, they unwittingly invite Alan -- an adult who's been trapped inside the game for 26 years -- into their living room. Alan's only hope for freedom is to finish the game, which proves risky as all three find themselves running from giant rhinoceroses, evil monkeys and other terrifying creatures.
## 3                                                                     A family wedding reignites the ancient feud between next-door neighbors and fishing buddies John and Max. Meanwhile, a sultry Italian divorcée opens a restaurant at the local bait shop, alarming the locals who worry she'll scare the fish away. But she's less interested in seafood than she is in cooking up a hot time with Max.
## 4                                                                                                                              Cheated on, mistreated and stepped on, the women are holding their breath, waiting for the elusive "good man" to break a string of less-than-stellar lovers. Friends and confidants Vannah, Bernie, Glo and Robin talk it all out, determined to find a better way to breathe.
## 5                                                                              Just when George Banks has recovered from his daughter's wedding, he receives the news that she's pregnant ... and that George's wife, Nina, is expecting too. He was planning on selling their home, but that's a plan that -- like George -- will have to change with the arrival of both a grandchild and a kid of his own.
## 6                                                             Obsessive master thief, Neil McCauley leads a top-notch crew on various insane heists throughout Los Angeles while a mentally unstable detective, Vincent Hanna pursues him without rest. Each man recognizes and respects the ability and the dedication of the other even though they are aware their cat-and-mouse game may end in violence.
##   popularity
## 1  21.946943
## 2  17.015539
## 3  11.712900
## 4   3.859495
## 5   8.387519
## 6  17.924927
##                                                                                                                  production_companies
## 1                                                                                      [{'name': 'Pixar Animation Studios', 'id': 3}]
## 2 [{'name': 'TriStar Pictures', 'id': 559}, {'name': 'Teitler Film', 'id': 2550}, {'name': 'Interscope Communications', 'id': 10201}]
## 3                                                     [{'name': 'Warner Bros.', 'id': 6194}, {'name': 'Lancaster Gate', 'id': 19464}]
## 4                                                                     [{'name': 'Twentieth Century Fox Film Corporation', 'id': 306}]
## 5                                        [{'name': 'Sandollar Productions', 'id': 5842}, {'name': 'Touchstone Pictures', 'id': 9195}]
## 6             [{'name': 'Regency Enterprises', 'id': 508}, {'name': 'Forward Pass', 'id': 675}, {'name': 'Warner Bros.', 'id': 6194}]
##                                         production_countries release_date
## 1 [{'iso_3166_1': 'US', 'name': 'United States of America'}]   1995-10-30
## 2 [{'iso_3166_1': 'US', 'name': 'United States of America'}]   1995-12-15
## 3 [{'iso_3166_1': 'US', 'name': 'United States of America'}]   1995-12-22
## 4 [{'iso_3166_1': 'US', 'name': 'United States of America'}]   1995-12-22
## 5 [{'iso_3166_1': 'US', 'name': 'United States of America'}]   1995-02-10
## 6 [{'iso_3166_1': 'US', 'name': 'United States of America'}]   1995-12-15
##     revenue runtime   status tagline                       title vote_average
## 1 373554033      81 Released       0                   Toy Story          7.7
## 2 262797249     104 Released       1                     Jumanji          6.9
## 3         0     101 Released       1            Grumpier Old Men          6.5
## 4  81452156     127 Released       1           Waiting to Exhale          6.1
## 5  76578911     106 Released       1 Father of the Bride Part II          5.7
## 6 187436818     170 Released       1                        Heat          7.7
##   vote_count
## 1       5415
## 2       2413
## 3         92
## 4         34
## 5        173
## 6       1886
##                                                                                                              genres_string
## 1                         [{'id': 16, 'name': 'Animation'}, {'id': 35, 'name': 'Comedy'}, {'id': 10751, 'name': 'Family'}]
## 2                        [{'id': 12, 'name': 'Adventure'}, {'id': 14, 'name': 'Fantasy'}, {'id': 10751, 'name': 'Family'}]
## 3                                                         [{'id': 10749, 'name': 'Romance'}, {'id': 35, 'name': 'Comedy'}]
## 4                            [{'id': 35, 'name': 'Comedy'}, {'id': 18, 'name': 'Drama'}, {'id': 10749, 'name': 'Romance'}]
## 5                                                                                           [{'id': 35, 'name': 'Comedy'}]
## 6 [{'id': 28, 'name': 'Action'}, {'id': 80, 'name': 'Crime'}, {'id': 18, 'name': 'Drama'}, {'id': 53, 'name': 'Thriller'}]
##        genre1    genre2    genre3 number_of_companies spoken_languages_count
## 1   Animation    Comedy    Family                   1                      1
## 2   Adventure   Fantasy    Family                   3                      2
## 3     Romance    Comedy                             2                      1
## 4      Comedy     Drama   Romance                   1                      1
## 5      Comedy                                       2                      1
## 6      Action     Crime     Drama                   3                      2
##   og_language
## 1     English
## 2     English
## 3     English
## 4     English
## 5     English
## 6     English

##Categorical Data

##            status     n
## 1        Canceled     2
## 2   In Production    20
## 3         Planned    15
## 4 Post Production    98
## 5        Released 44985
## 6         Rumored   229
## 7            <NA>    85
##   status_collapsed     n
## 1      In Progress   133
## 2         Released 44985
## 3       Unreleased   231
## 4             <NA>    85

#Credits Dataset

## Warning: One or more parsing issues, call `problems()` on your data frame for details,
## e.g.:
##   dat <- vroom(...)
##   problems(dat)
## Rows: 45466 Columns: 24
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (14): belongs_to_collection, genres, homepage, imdb_id, original_langua...
## dbl   (7): budget, id, popularity, revenue, runtime, vote_average, vote_count
## lgl   (2): adult, video
## date  (1): release_date
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

#Ratings Dataset

## Warning: One or more parsing issues, call `problems()` on your data frame for details,
## e.g.:
##   dat <- vroom(...)
##   problems(dat)
## Rows: 45466 Columns: 24
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (14): belongs_to_collection, genres, homepage, imdb_id, original_langua...
## dbl   (7): budget, id, popularity, revenue, runtime, vote_average, vote_count
## lgl   (2): adult, video
## date  (1): release_date
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

#Merge

#Esquisse

Statistical Techniques .

##Vote Average Histogram

## Warning: Removed 4 rows containing non-finite outside the scale range
## (`stat_bin()`).
## Warning: Removed 2 rows containing missing values or values outside the scale range
## (`geom_bar()`).

##Runtime Histogram

## Warning: Removed 261 rows containing non-finite outside the scale range
## (`stat_density()`).

##Release Date Density

## Warning: Removed 88 rows containing non-finite outside the scale range
## (`stat_bin()`).

##Genre 1 Bar Graph

##Budget Distribution

## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_bin()`).

##OG Language Bar Graph

## Loading required package: RColorBrewer

##Stats MOVIES5

## [1] 4520608
## [1] 3.267197e+14
## [1] 18075390
## [1] 0
## [1] 0
## [1] 3.8e+08
## [1] 0.0e+00 3.8e+08
## [1] 6.856643
## [1] 3.998442
## [1] 363612.3

##Runtime and popularity analysis

## `geom_smooth()` using formula = 'y ~ x'

##       N         r
## 1 42006 0.5061554
## [1] 18075390

Conclusions .

We can conclude that the most successful films tend to focus on themes that resonate with the human experience, such as everyday life, family relationships and love. In addition, it is crucial to recognize that the use of elements related to youth and friendship tends to attract a younger audience to these productions. The inclusion of more serious subject matter, such as war and the exploration of the female experience, also demonstrates the importance of addressing the diversity of genres and perspectives in filmmaking.

You can find the original data base in the next link : https://www.kaggle.com/datasets/rounakbanik/the-movies-dataset

References .

Banik, R. (2017). The Movies Dataset. Kaggle.com. https://www.kaggle.com/datasets/rounakbanik/the-movies-dataset

LS0tCnRpdGxlOiAiRmluYWwgRXZpZGVuY2UiCmF1dGhvcjogIkpvcmdlIFBvbnMgLSBBMDE0MjQxMDgiCmRhdGU6ICIyMDI0LTA0LTI5IgpvdXRwdXQ6CiBodG1sX2RvY3VtZW50OiAKICAgIHRvYzogVFJVRQogICAgdG9jX2Zsb2F0OiBUUlVFCiAgICBjb2RlX2Rvd25sb2FkOiBUUlVFCiAgICB0aGVtZTogImRhcmtseSIKLS0tCmBgYHtyIHNldHVwLCBpbmNsdWRlPUZBTFNFfQprbml0cjo6b3B0c19jaHVuayRzZXQoZWNobyA9IEZBTFNFKQpgYGAKIVtdKC9Vc2Vycy9qb3Jwb25zL0Rlc2t0b3AvUEhPVE8tMjAyNC0wNS0wMy0xNC00Ni0yMy5qcGcpCgojIDxzcGFuIHN0eWxlID0gImNvbG9yOiBSZWQ7Ij5UYWJsZSBvZiBDb250ZW50czwvc3Bhbj4gCjEuIERlc2NyaXB0aW9uIG9mIFByb2JsZW0KMi4gSW50cm9kdWN0aW9uCjMuIE9iamVjdGl2ZSBvZiB0aGUgUHJvYmxlbQo0LiBTdGF0aXN0aWNhbCBUZWNobmlxdWVzCjUuIENvbmNsdXNpb24KNi4gUmVmZXJlbmNlcwoKIyA8c3BhbiBzdHlsZSA9IC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