-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathREADME.Rmd
101 lines (71 loc) · 4.14 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
[![codecov](https://codecov.io/gh/RMHogervorst/imdb/branch/master/graph/badge.svg)](https://codecov.io/gh/RMHogervorst/imdb)[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/imdb)](https://cran.r-project.org/package=imdb)[![Last-changedate](https://img.shields.io/badge/last%20change-2017--03--03-yellowgreen.svg)](/commits/master)[![Licence](https://img.shields.io/badge/licence-MIT-lightgrey.svg)](http://choosealicense.com/)[![minimal R version](https://img.shields.io/badge/R-3.2.2-6666ff.svg)](https://cran.r-project.org/)[![Project Status: active – The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active)[![Build Status](https://travis-ci.org/RMHogervorst/imdb.svg?branch=master)](https://travis-ci.org/RMHogervorst/imdb)
# Wat can I do with the imdb package?
The package imdb helps you in downloading series and movie information from imdb (it uses the omdbi api). It has three functions
one for basic information about series and a second one that also downloads synopsis, actors etc.
A third function downloads information about movies.
A walkthrough in the [vignette](articles/walktrough.html) provides more information.
# Installation instructions
For now you will have to install using `devtools::install_github("rmhogervorst/imdb")`
To make calls to the API you need an API-key.
go to <https://www.omdbapi.com/apikey.aspx> and register for a
free key. You can make a 1000 calls per day with the free account.
Add the key to your .Renviron (~/.Renviron) file:
add a line like 'OMDB_KEY = xxxkeyxxx' to the file.
Or use the function add_key_to_renviron from the package.
# Example usage
imdb has 4 functions:
- imdbSeries()
- enrichIMDB() and
- imdbMovies() and
- imdbTitleId()
With the function 'imdbSeries(seriesname = "name of series", seasons = number(s))'
you can call up general information about series. Note that the api is does
not really care about case. "Game of Thrones" or "game of thrones" or
"gAmE oF tHrONes " is all fine.
```{r example for game of trones season 1}
library(imdb)
imdbSeries("game of thrones ")
```
The command will return a data frame with Title, releasedate, episodenumber
imdb-rating, imdb ID and season.
Would you like to know more about your series? Use the `enrichIMDB` command:
```{r enrichIMDB example game of thrones}
season2GOT <-imdbSeries("game of thrones", seasons = 2)
season2GOT_enriched <- enrichIMDB(season2GOT)
```
The enrichIMDB command returns a seperate dataframe with
imdbID, runtime, director, writer, actors, plot (complete synopsis), and votes
per episode. It uses the imdbid of the episode to scour for more information.
So if you'd like to know how many times Jon Snow appears in the synopsis,
or how many times Peter Dinklage plays in season 2, you can now search for it.
```{r examples}
grep("Jon", season2GOT_enriched$plot)
grep("Peter Dinklage", season2GOT_enriched$actors)
```
Combining the information from the two dataframes can also be very useful.
```{r combining everything, eval=FALSE}
library(ggplot2)
suppressPackageStartupMessages(library(dplyr))
GOTall<-imdbSeries("game of Thrones", 1:6)
GOT <-left_join(GOTall, enrichIMDB(GOTall), by = "imdbID")
ggplot(GOT, aes(Episode, imdbRating)) +
geom_smooth(aes(color = as.factor(Season)),se = FALSE , alpha = 1/10)+
geom_point(aes(color = as.factor(Season), size = votes))+
ggtitle("Rating per episode of GoT, \ncolored by season\nwith smoothlines")
```
# Contact
I'm always looking for people to help me improve my work.
Contact me directly, use an [issue](https://github.com/RMHogervorst/imdb/issues), fork me or submit a pull request.
[![star this repo](http://githubbadges.com/star.svg?user=RMHogervorst&repo=imdb&style=flat)](https://github.com/RMHogervorst/imdb)
[![fork this repo](http://githubbadges.com/fork.svg?user=RMHogervorst&repo=imdb&style=flat)](https://github.com/RMHogervorst/imdb/fork)