The Open Movie Database is a API which allows for access freely to information about data related to movies which can be found on IMDB as well as information about ratings from IMDB and Rotten Tomato’s. The API information can be found at the website http://www.omdbapi.com where users can create their own API keys with quick sign up.
The requirement of all the package above is not required for the first part of the API but for the the full document all will be used.
library(httr) library(dplyr) library(tidyverse) library(ggplot2) library(ggrepel)
The call default below is how you start a call in the OMDb API and then attach the API given to you by the website.
call_default <- "http://www.omdbapi.com/?apikey=" api_key <- "d60ab312"
start_call <- paste(call_default, api_key, sep = "")
The way to call a specific movie in the case of OMDb is by using the title function with is t. This example will use the move Jaws by Steven Spielberg.
Jaws <- GET(paste(start_call,"t=jaws",sep="&"))
Below is a list of Quentin Tarantino movies and a empty list which will be used later the list is then fed into a for loop which looks through the movies and call all the movies into the list that is the movies through the movie data. This put all the data into a list and is not in a usable for making visualizations from when it is going through for loop and is just looking through all the data by searching each movie and then covering the data it pulls from the API into a list.
Tarantino_Movies_title <- c("Reservoir Dogs", "Pulp Fiction", "Jackie Brown", "Kill Bill: Vol. 1", "Kill Bill: Vol. 2", "Death Proof", "Inglourious Basterds", "Django Unchained", "The Hateful Eight", "Once Upon a Time in Hollywood")
Tarantino_Movies <- list()
for (title in Tarantino_Movies_title) { movie_call <- paste(start_call, "&t=", URLencode(title), sep = "") call <- GET(movie_call) movie_info <- content(call, "parsed") Tarantino_Movies[[title]] <- movie_info }
The list is then taken and looked at by the title of the movie which is above and only one of the movies is taken which is the distinct below which looks at the movie title and not rating which there are three different ratings sites for each movie which do not need to be recorded. This is now in a data frame where it can be used in a way which can be used to make visualizations.
movie_data <- bind_rows(Tarantino_Movies, .id = "Title") %>% distinct(Title, .keep_all = TRUE)
movie_data %>% ggplot(aes(x = Year, y = BoxOffice)) + geom_col() + geom_text_repel(aes(label=Title))+ labs(title = "Tarantino movies By the amount they made in the Box Office")
view(movie_data)
The graph Tarantino movies By the amount they made in the Box Office looks at the movies which Tarantino made through the years and compares their Box Office earnings and tries to see if there is more money made at a certain time. In seems like out of the films he has made the there does not seem to be a difference in the money he makes for his films from the start to the most recent part of his career.