-
Notifications
You must be signed in to change notification settings - Fork 0
/
libraries.Rmd
31 lines (27 loc) · 1.27 KB
/
libraries.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
---
title: "Libraries"
---
My Plex server has a few different movie libraries. This is mostly so I can filter more easily. In all the other statistics I don't differentiate between them but I still think there should be a short look at it.
```{r message=FALSE, warning=FALSE, echo=FALSE}
# load libraries
library(readr)
library(dplyr)
library(ggplot2)
```
Simply load all `.csv` files independently..
```{r message=FALSE, warning=FALSE}
movies <- read_csv('data/Movies.csv')
animated_movies <- read_csv('data/Animated_Movies.csv')
anime_movies <- read_csv('data/Anime_Movies.csv')
documentaries <- read_csv('data/Documentary_Movies.csv')
kids_movies <- read_csv('data/Kids_Movies.csv')
```
and then create a new data frame with a row count from each library data frame. Then create a graph and BOOM! stats.
```{r message=FALSE, warning=FALSE}
amount_of_movies <- data.frame(Library=c("Animated Movies", "Anime Movies", "Documentaries", "Kids Movies", "Movies"), Amount=c(nrow(animated_movies), nrow(anime_movies), nrow(documentaries), nrow(kids_movies), nrow(movies)))
amount_of_movies %>%
ggplot(aes(x=Library, y=Amount, color=Amount)) +
geom_bar(stat="identity", fill="white") +
geom_text(aes(label=Amount), position = position_dodge(1.9), size=3.5, vjust=1.6) +
theme_classic()
```