Get Top Grossing movies

Jacob Kaplan

2019-04-20

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                               Avatar          2009
#> 4    3                        Black Panther          2018
#> 5    4               Avengers: Infinity War          2018
#> 6    5                              Titanic          1997
#> 7    6                       Jurassic World          2015
#>   american_box_office international_box_office total_box_office
#> 2           936662225               1116648995       2053311220
#> 3           760507625               2015837654       2776345279
#> 4           700059566                648198658       1348258224
#> 5           678815482               1369982200       2048797682
#> 6           659363944               1548844451       2208208395
#> 7           652270625                996584239       1648854864
# 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                              Titanic          1997
#> 4    3               Avengers: Infinity War          2018
#> 5    4                            Furious 7          2015
#> 6    5 Star Wars Ep. VII: The Force Awakens          2015
#> 7    6              The Fate of the Furious          2017
#>   american_box_office international_box_office total_box_office
#> 2           760507625               2015837654       2776345279
#> 3           659363944               1548844451       2208208395
#> 4           678815482               1369982200       2048797682
#> 5           353007020               1165715774       1518722794
#> 6           936662225               1116648995       2053311220
#> 7           225764765               1009081502       1234846267
# 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                               Avatar          2009
#> 3    2                              Titanic          1997
#> 4    3 Star Wars Ep. VII: The Force Awakens          2015
#> 5    4               Avengers: Infinity War          2018
#> 6    5                       Jurassic World          2015
#> 7    6                            Furious 7          2015
#>   american_box_office international_box_office total_box_office
#> 2           760507625               2015837654       2776345279
#> 3           659363944               1548844451       2208208395
#> 4           936662225               1116648995       2053311220
#> 5           678815482               1369982200       2048797682
#> 6           652270625                996584239       1648854864
#> 7           353007020               1165715774       1518722794

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                               Avatar          2009
#> 4    3                        Black Panther          2018
#> 5    4               Avengers: Infinity War          2018
#> 6    5                              Titanic          1997
#> 7    6                       Jurassic World          2015
#>   american_box_office international_box_office total_box_office
#> 2           936662225               1116648995       2053311220
#> 3           760507625               2015837654       2776345279
#> 4           700059566                648198658       1348258224
#> 5           678815482               1369982200       2048797682
#> 6           659363944               1548844451       2208208395
#> 7           652270625                996584239       1648854864
# 
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
#> 36     34                       Captain Marvel          2019
#> 57     55                              Minions          2015
#> 66     64                           Deadpool 2          2018
#> 1029 1000                           Free Willy          1993
#>      american_box_office international_box_office total_box_office
#> 2              936662225               1116648995       2053311220
#> 36             394071133                677890586       1071961719
#> 57             336045770                824290403       1160336173
#> 66             324591735                462088822        786680557
#> 1029            77698625                 76000000        153698625