generated from fhdsl/metricminer-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyoutube.Rmd
70 lines (63 loc) · 3.04 KB
/
youtube.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
---
title: "OCS Video Views on YouTube"
output:
html_document:
toc: true
toc_float: true
toc_collapsed: true
date: "`r format(Sys.time(), '%d %B, %Y')`"
---
```{r, echo = FALSE, hide = TRUE, message = FALSE, warning = FALSE}
library(tidyverse)
root_dir <- rprojroot::find_root(rprojroot::has_dir(".git"))
yaml <- yaml::read_yaml(file.path(root_dir, "_config_automation.yml"))
## For Youtube
youtube <- readr::read_tsv(file.path("metricminer_data", "youtube", "youtube.tsv"))
```
### Video views
```{r echo= FALSE, message = FALSE, warning = FALSE, fig.width=13.24, fig.height=6.91}
video_id_to_name <- data.frame(id = c("DgzBSOY5Yc8",
"MZ0mHQhgPiA",
"UFs4qvgTuTw",
"rP5E7GohTiI",
"OHqamzlrnaw",
"3iFtuDK0o-M",
"Dd4KASCIsNc",
"fVeaVm9g6Kg",
"j-I0Zgicjsk",
"Z4WZ7A0OZF8"
),
name = c("Open Case Studies",
"Translation Tool",
"Open Case Studies Modification",
"Create a Case Study with the OCS Template",
"OCS Search",
"Interactive Case Studies and Independent Learners",
"Create a Case Study with the MakeCaseStudies App",
"Interactive Open Case Studies",
"Navigating with the Table of Contents",
"How to Skip to a Section"
),
description = c("Intro",
"Mechanics",
"Creating a case study",
"Creating a case study",
"Finding a case study",
"Finding a case study",
"Creating a case study",
"Intro",
"Mechanics",
"Mechanics"
)
)
youtube <- left_join(youtube, video_id_to_name, by=c("video"="id"))
youtube %>%
ggplot(aes(y = reorder(name, viewCount), x = viewCount, fill = description)) +
geom_bar(stat = "identity") +
theme_classic() +
labs(fill = "") +
xlab("Video Views") +
ylab("") +
geom_text(aes(label = viewCount, group = name),
hjust = -0.5, size=3)
```