-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathREADME.Rmd
114 lines (81 loc) · 2.83 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
102
103
104
105
106
107
108
109
110
111
112
113
114
---
output: rmarkdown::github_document
editor_options:
chunk_output_type: console
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, echo=FALSE}
knitr::opts_chunk$set(
message = FALSE,
warning = FALSE,
fig.retina = 2,
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
omdbapi is an R package wrapper for the [Open Movie Database API](https://www.omdbapi.com/)
NOTE: THE OMDB API NOW REQUIRES AN API KEY <https://www.patreon.com/posts/api-is-going-10743518>
The following functions are implemented:
- `find_by_id`: Retrieve OMDB info by IMDB ID search
- `find_by_title`: Retrieve OMDB info by title search
- `get_actors`: Get actors from an omdb object as a vector
- `get_countries`: Get countries from an omdb object as a vector
- `get_directors`: Get directors from an omdb object as a vector
- `get_genres`: Get genres from an omdb object as a vector
- `get_writers`: Get writers from an omdb object as a vector
- `search_by_title`: Lightweight OMDB title search
### News
- Version `0.3.0` released (API key support & https URL switch)
- ibartomeus adds pagination option.
- Version `0.1.0.9000` released
- Version `0.2.0.9000` released - better types in the data frames and `get_` methods to split the fields with multiple entries
### Installation
```{r installation, eval=FALSE}
devtools::install_github("hrbrmstr/omdbapi")
```
```{r setwidth, echo=FALSE, message=FALSE, warning=FALSE, error=FALSE}
options(width=80)
```
### Usage
```{r usage}
library(omdbapi)
library(tidyverse)
# current verison
packageVersion("omdbapi")
search_by_title("Captain America")
search_by_title("Star Wars", page = 2)
search_by_title("Captain America", year_of_release=2013)
games <- search_by_title("Captain America", type="game")
glimpse(games)
find_by_title(games$Title[1])
find_by_title("Game of Thrones", type="series", season=1, episode=1)
get_genres(find_by_title("Star Trek: Deep Space Nine", season=5, episode=7))
get_writers(find_by_title("Star Trek: Deep Space Nine", season=4, episode=6))
get_directors(find_by_id("tt1371111"))
get_countries(find_by_title("The Blind Swordsman: Zatoichi"))
```
```{r cache=TRUE}
ichi <- search_by_title("Zatoichi")
pb <- progress_estimated(length(ichi$imdbID))
zato <- purrr::map_df(ichi$imdbID, find_by_id)
zato
```
```{r fig.width=10, fig.height=2.5}
ggplot(zato, aes(x="IMDB Rating", imdbRating)) +
geom_boxplot() +
scale_y_continuous(limits=c(0,10)) +
coord_flip() +
labs(x=NULL, y=NULL, title="Distribution of IMDB Ratings for Zatoichi movies") +
hrbrthemes::theme_ipsum_rc(grid="X")
```
### Test Results
```{r test}
library(omdbapi)
library(testthat)
date()
test_dir("tests/")
```
### Code of Conduct
Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md).
By participating in this project you agree to abide by its terms.