This analysis explores how movie genre relates to box office performance using a dataset of approximately 5,000 movies released between 2000 and 2025. The goal is to determine which genres tend to generate the highest box office revenue and to create a cleaner subset of the original data for analysis. Original Link: https://www.kaggle.com/datasets/arezazare/imdb-popular-movies-with-tmdb-enrichment/data
movies <- read.csv("https://raw.githubusercontent.com/mj-nurse/mnurse-data_607/refs/heads/main/assignment-01-basic-loading-transformation/movies.csv")
head(movies)
## IMDb_ID Title
## 1 tt0468569 The Dark Knight
## 2 tt1375666 Inception
## 3 tt0816692 Interstellar
## 4 tt0120737 The Lord of the Rings: The Fellowship of the Ring
## 5 tt0167260 The Lord of the Rings: The Return of the King
## 6 tt1345836 The Dark Knight Rises
## originalTitle isAdult Year Runtime
## 1 The Dark Knight 0 2008 152
## 2 Inception 0 2010 148
## 3 Interstellar 0 2014 169
## 4 The Lord of the Rings: The Fellowship of the Ring 0 2001 178
## 5 The Lord of the Rings: The Return of the King 0 2003 201
## 6 The Dark Knight Rises 0 2012 164
## Genres Rating Votes Director
## 1 Action,Crime,Drama 9.0 3026849 Christopher Nolan
## 2 Action,Adventure,Sci-Fi 8.8 2689250 Christopher Nolan
## 3 Adventure,Drama,Sci-Fi 8.7 2351408 Christopher Nolan
## 4 Adventure,Drama,Fantasy 8.9 2112326 Peter Jackson
## 5 Adventure,Drama,Fantasy 9.0 2082262 Peter Jackson
## 6 Action,Crime,Drama 8.4 1916439 Christopher Nolan
## Writer
## 1 Bob Kane, David S. Goyer, Christopher Nolan, Jonathan Nolan
## 2 Christopher Nolan
## 3 Christopher Nolan, Jonathan Nolan
## 4 Peter Jackson, Philippa Boyens, J.R.R. Tolkien, Fran Walsh
## 5 Peter Jackson, Philippa Boyens, J.R.R. Tolkien, Fran Walsh
## 6 Bob Kane, David S. Goyer, Christopher Nolan, Jonathan Nolan
## Actors
## 1 Christian Bale, Aaron Eckhart, Heath Ledger
## 2 Leonardo DiCaprio, Joseph Gordon-Levitt, Elliot Page
## 3 Matthew McConaughey, John Lithgow, Timothée Chalamet
## 4 Elijah Wood, Ian McKellen, Orlando Bloom
## 5 Elijah Wood, Viggo Mortensen, Ian McKellen
## 6 Gary Oldman, Christian Bale, Tom Hardy
## Plot
## 1 Batman raises the stakes in his war on crime. With the help of Lt. Jim Gordon and District Attorney Harvey Dent, Batman sets out to dismantle the remaining criminal organizations that plague the streets. The partnership proves to be effective, but they soon find themselves prey to a reign of chaos unleashed by a rising criminal mastermind known to the terrified citizens of Gotham as the Joker.
## 2 Cobb, a skilled thief who commits corporate espionage by infiltrating the subconscious of his targets is offered a chance to regain his old life as payment for a task considered to be impossible: "inception", the implantation of another person's idea into a target's subconscious.
## 3 The adventures of a group of explorers who make use of a newly discovered wormhole to surpass the limitations on human space travel and conquer the vast distances involved in an interstellar voyage.
## 4 Young hobbit Frodo Baggins, after inheriting a mysterious ring from his uncle Bilbo, must leave his home in order to keep it from falling into the hands of its evil creator. Along the way, a fellowship is formed to protect the ringbearer and make sure that the ring arrives at its final destination: Mt. Doom, the only place where it can be destroyed.
## 5 As armies mass for a final battle that will decide the fate of the world--and powerful, ancient forces of Light and Dark compete to determine the outcome--one member of the Fellowship of the Ring is revealed as the noble heir to the throne of the Kings of Men. Yet, the sole hope for triumph over evil lies with a brave hobbit, Frodo, who, accompanied by his loyal friend Sam and the hideous, wretched Gollum, ventures deep into the very dark heart of Mordor on his seemingly impossible quest to destroy the Ring of Power.
## 6 Following the death of District Attorney Harvey Dent, Batman assumes responsibility for Dent's crimes to protect the late attorney's reputation and is subsequently hunted by the Gotham City Police Department. Eight years later, Batman encounters the mysterious Selina Kyle and the villainous Bane, a new terrorist leader who overwhelms Gotham's finest. The Dark Knight resurfaces to protect a city that has branded him an enemy.
## Budget Revenue Popularity
## 1 185000000 1004558444 26.6430
## 2 160000000 839030630 25.3304
## 3 165000000 746606706 37.6389
## 4 93000000 871368364 24.5299
## 5 94000000 1118888979 19.8345
## 6 250000000 1081041287 15.1994
## Tagline
## 1 Welcome to a world without rules.
## 2 Your mind is the scene of the crime.
## 3 Mankind was born on Earth. It was never meant to die here.
## 4 One ring to rule them all.
## 5 There can be no triumph without loss. No victory without suffering. No freedom without sacrifice.
## 6 The legend ends.
## TMDb_ID Country
## 1 155 United Kingdom, United States of America
## 2 27205 United Kingdom, United States of America
## 3 157336 United Kingdom, United States of America
## 4 120 New Zealand, United States of America
## 5 122 New Zealand, United States of America
## 6 49026 United Kingdom, United States of America
## Languages
## 1 English, 普通话
## 2 English, Français, 日本語, Kiswahili
## 3 English
## 4 English
## 5 English
## 6 English
## Poster_URL
## 1 https://image.tmdb.org/t/p/w500/qJ2tW6WMUDux911r6m7haRef0WH.jpg
## 2 https://image.tmdb.org/t/p/w500/oYuLEt3zVCKq57qu2F8dT7NIa6f.jpg
## 3 https://image.tmdb.org/t/p/w500/gEU2QniE6E77NI6lCU6MxlNBvIx.jpg
## 4 https://image.tmdb.org/t/p/w500/6oom5QYQ2yQTMJIbnvbkBL9cHo6.jpg
## 5 https://image.tmdb.org/t/p/w500/rCzpDGLbOoPwLjy3OAm5NUPOTrC.jpg
## 6 https://image.tmdb.org/t/p/w500/hr0L2aueqlP2BYUblTTjmtn0hw4.jpg
dim(movies)
## [1] 5000 21
names(movies)
## [1] "IMDb_ID" "Title" "originalTitle" "isAdult"
## [5] "Year" "Runtime" "Genres" "Rating"
## [9] "Votes" "Director" "Writer" "Actors"
## [13] "Plot" "Budget" "Revenue" "Popularity"
## [17] "Tagline" "TMDb_ID" "Country" "Languages"
## [21] "Poster_URL"
movie_data <- movies[, c("Title", "Year", "Genres", "Rating", "Budget", "Revenue")]
names(movie_data) <- c(
"Movie_Title",
"Release_Year",
"Genres",
"IMDb_Rating",
"Budget",
"Box_Office_Revenue"
)
head(movie_data)
## Movie_Title Release_Year
## 1 The Dark Knight 2008
## 2 Inception 2010
## 3 Interstellar 2014
## 4 The Lord of the Rings: The Fellowship of the Ring 2001
## 5 The Lord of the Rings: The Return of the King 2003
## 6 The Dark Knight Rises 2012
## Genres IMDb_Rating Budget Box_Office_Revenue
## 1 Action,Crime,Drama 9.0 185000000 1004558444
## 2 Action,Adventure,Sci-Fi 8.8 160000000 839030630
## 3 Adventure,Drama,Sci-Fi 8.7 165000000 746606706
## 4 Adventure,Drama,Fantasy 8.9 93000000 871368364
## 5 Adventure,Drama,Fantasy 9.0 94000000 1118888979
## 6 Action,Crime,Drama 8.4 250000000 1081041287
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(tidyr)
genre_box_office <- movie_data %>%
filter(!is.na(Box_Office_Revenue), Box_Office_Revenue > 0) %>%
separate_rows(Genres, sep = ",") %>%
mutate(Genres = trimws(Genres)) %>%
group_by(Genres) %>%
summarise(
Movie_Count = n(),
Average_Box_Office_Revenue = mean(Box_Office_Revenue),
.groups = "drop"
) %>%
arrange(desc(Average_Box_Office_Revenue))
genre_box_office
## # A tibble: 22 × 3
## Genres Movie_Count Average_Box_Office_Revenue
## <chr> <int> <dbl>
## 1 Animation 271 303570689.
## 2 Adventure 924 301271441.
## 3 Sci-Fi 352 237244604.
## 4 Fantasy 353 216696440.
## 5 Family 202 210686314.
## 6 Action 1256 197890482.
## 7 Musical 41 128614029.
## 8 Comedy 1489 122676233.
## 9 Western 12 116322885.
## 10 Thriller 747 93684081.
## # ℹ 12 more rows
Based on the dataset, Animation had the highest average box office revenue at approximately 303.6 million dollars per movie, followed closely by Adventure at approximately 301.3 million dollars. Sci-Fi also performed strongly in 3rd place with an average box office revenue of about $237.2 million.
These results suggest that Animation and Adventure tend to perform especially well at the box office within the 21st century. However, the number of movies varies considerably across genres, so future analysis could compare median revenue, examine profitability relative to budget, or if I wanted to take it to the next level, study how genre performance has changed over time.