-
Notifications
You must be signed in to change notification settings - Fork 14
/
build_readme.R
58 lines (46 loc) · 1.52 KB
/
build_readme.R
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
#### This script builds the README.md
#### for R/Pharma 2020 workshops and talks
library(tidyverse)
library(glue)
## Params
loc_data <- "talks_table.csv"
## Process
data <- read_csv(loc_data, locale = locale(encoding = 'latin1'), na = character())
## Print
sink('README.md')
cat("## Building this document\n\n")
cat("To build this README, run `build_readme.R`. Talks data is in csv `talks_table.csv`\n\n")
cat("## Workshops\n\n")
data %>%
filter(Type == 'workshop') %>%
rowwise() %>%
mutate(txt = paste0(paste0("<strong>", unlist(strsplit(Name, " // ")), "</strong> (<i>", unlist(strsplit(Affiliation, " // ")), "</i>)"), collapse = ", ")) %>%
mutate(video_link = if_else(nchar(youtube) > 0, paste0(" [Workshop Recording](", youtube, ")"), "")) %>%
glue_data(
"{txt}<br>{Title}",
"<details><summary>Abstract</summary>",
"<p>{Abstract}</p>",
"</details>",
"[Link to Workshop Material]({Slides})",
"{video_link}",
"<br><br>"
)
x <- lapply(1:3, function(i) {
data %>%
filter(Type == "talk") %>%
filter(Day == i) %>%
rowwise() %>%
mutate(txt = paste0(paste0("<strong>", unlist(strsplit(Name, " // ")), "</strong> (<i>", unlist(strsplit(Affiliation, " // ")), "</i>)"), collapse = ", ")) %>%
glue_data(
"{txt}<br>{Title}",
"<details><summary>Abstract</summary>",
"</p>{Abstract}</p>",
"</details>",
"[Slides]({Slides})<br><br>"
)
})
for (i in 1:3) {
cat("\n\n## Talks - Day ", i, "\n\n")
cat(x[[i]])
}
sink()