README.md

R Open Movie Database API

Ever wanted to get movie information in R?

This is a test package for UBC STAT547, but is fully functional and allows you to extract movie information (e.g., plot summary, ratings, actors) using the Open Movie Database API.

Note: requires an active internet connection to use.

Usage

Install the package from Github:

install_github("sho-87/Romdb")

If it complains about packages not being found (e.g. stringi, curl), you'll need to manually install those packages before running install_github:

install.packages("curl")

install.packages("stringi")

Load it into your R session:

library(Romdb)

Search Movie

You can search OMDb with a search string to see movies that share the same/a similar name:

results <- search_movie("matrix")

Note: a string must be passed to the function.

The above will return a dataframe containing movies with a matching name, plus any relevant information about the movie.

The returned dataframe contains:

Get Movie

If you know the specific movie name you're interested in, you can query the database for just that film and extract all information associated with it:

movie <- get_movie("Frozen")

Note: a string must be passed to the function.

This returns a list containing information about the movie.

The following information is available for each movie:

To extract only specific variables from the list use the $ syntax in R

Examples

library(Romdb)

searchResults <- search_movie("hunger games")

hungerGamesMovie <- get_movie("The Hunger Games")

hungerGamesMovie$Plot

hungerGamesMovie$tomatoRating

hungerGamesMovie$Metascore


sho-87/Romdb documentation built on May 29, 2019, 9:26 p.m.