Get Top Grossing movies

Jacob Kaplan

2019-10-25

This function collects data from the-numbers’ list of movies ordered by how much money they made. This list is ordered by the total sales in one of three jurisdictions: American(usually called domestic), international, and worldwide (domestic+international). The first parameter, type, lets you choose which of these jurisdictions you want the data ordered by. The data scraped is the name of the movie, its rank based on the order in the list type you select, and how much it made for all three jurisdictions. The second and only other parameter, ranks lets you select movies in certain ranks - e.g. the top 10 movies, #s 100-105, etc.

type

The parameter type lets you choose if you want the list of top grossing movies ordered by sales in “American”, by “international” sales, or “worldwide” sales. As some movies do better out of the America, this results in slightly differed ordering. The default selection is America.

# America
movies <- boxoffice::top_grossing(type = "American")
#> Please note that these numbers are not adjusted for inflation.
head(movies)
#>   rank                                movie year_released
#> 2    1 Star Wars Ep. VII: The Force Awakens          2015
#> 3    2                    Avengers: Endgame          2019
#> 4    3                               Avatar          2009
#> 5    4                        Black Panther          2018
#> 6    5               Avengers: Infinity War          2018
#> 7    6                              Titanic          1997
#>   american_box_office international_box_office total_box_office
#> 2           936662225               1116648995       2053311220
#> 3           858373000               1937100000       2795473000
#> 4           760507625               2029197650       2789705275
#> 5           700059566                648198658       1348258224
#> 6           678815482               1369318718       2048134200
#> 7           659363944               1548844451       2208208395
# International
movies <- boxoffice::top_grossing(type = "international")
#> Please note that these numbers are not adjusted for inflation.
head(movies)
#>   rank                                movie year_released
#> 2    1                               Avatar          2009
#> 3    2                    Avengers: Endgame          2019
#> 4    3                              Titanic          1997
#> 5    4               Avengers: Infinity War          2018
#> 6    5                            Furious 7          2015
#> 7    6 Star Wars Ep. VII: The Force Awakens          2015
#>   american_box_office international_box_office total_box_office
#> 2           760507625               2029197650       2789705275
#> 3           858373000               1937100000       2795473000
#> 4           659363944               1548844451       2208208395
#> 5           678815482               1369318718       2048134200
#> 6           353007020               1165715774       1518722794
#> 7           936662225               1116648995       2053311220
# Worldwide
movies <- boxoffice::top_grossing(type = "worldwide")
#> Please note that these numbers are not adjusted for inflation.
head(movies)
#>   rank                                movie year_released
#> 2    1                    Avengers: Endgame          2019
#> 3    2                               Avatar          2009
#> 4    3                              Titanic          1997
#> 5    4 Star Wars Ep. VII: The Force Awakens          2015
#> 6    5               Avengers: Infinity War          2018
#> 7    6                       Jurassic World          2015
#>   american_box_office international_box_office total_box_office
#> 2           858373000               1937100000       2795473000
#> 3           760507625               2029197650       2789705275
#> 4           659363944               1548844451       2208208395
#> 5           936662225               1116648995       2053311220
#> 6           678815482               1369318718       2048134200
#> 7           652270625                996584239       1648854864

ranks

The ranks parameter accepts a vector of numbers indicating which rank(s) you want returned. For example using 1-5 will return only the top 5 movies. The default selection is to return ranks 1-100.

movies <- boxoffice::top_grossing()
#> Please note that these numbers are not adjusted for inflation.
head(movies)
#>   rank                                movie year_released
#> 2    1 Star Wars Ep. VII: The Force Awakens          2015
#> 3    2                    Avengers: Endgame          2019
#> 4    3                               Avatar          2009
#> 5    4                        Black Panther          2018
#> 6    5               Avengers: Infinity War          2018
#> 7    6                              Titanic          1997
#>   american_box_office international_box_office total_box_office
#> 2           936662225               1116648995       2053311220
#> 3           858373000               1937100000       2795473000
#> 4           760507625               2029197650       2789705275
#> 5           700059566                648198658       1348258224
#> 6           678815482               1369318718       2048134200
#> 7           659363944               1548844451       2208208395
# 
movies <- boxoffice::top_grossing(ranks = 1)
#> Please note that these numbers are not adjusted for inflation.
head(movies)
#>   rank                                movie year_released
#> 2    1 Star Wars Ep. VII: The Force Awakens          2015
#>   american_box_office international_box_office total_box_office
#> 2           936662225               1116648995       2053311220
# Worldwide
movies <- boxoffice::top_grossing(ranks = c(1000, 34, 1, 55, 64))
#> Please note that these numbers are not adjusted for inflation.
head(movies)
#>      rank                                 movie year_released
#> 2       1  Star Wars Ep. VII: The Force Awakens          2015
#> 35     34                            Spider-Man          2002
#> 56     55 The Lord of the Rings: The Two Towers          2002
#> 65     64    Batman v Superman: Dawn of Justice          2016
#> 1019 1000                             Limitless          2011
#>      american_box_office international_box_office total_box_office
#> 2              936662225               1116648995       2053311220
#> 35             403706375                418000000        821706375
#> 56             342548984                592150661        934699645
#> 65             330360194                537140087        867500281
#> 1019            79249455                 76315464        155564919