-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlectures.Rmd
102 lines (86 loc) · 3.89 KB
/
lectures.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
---
title: "Lecture presentations"
output: html_document
---
<br>
### Meeting days & times
Tuesday & Thursday from 1:30-2:50 via Zoom
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(kableExtra)
load("syllabus.RData")
```
```{r lecture_topics, include = FALSE}
lec_topics <- lapply(week_lecs, function(x){if(is.list(x)){x$topics}else{""}})
## topics formatted for html
lec_topics_html <- sapply(lapply(lec_topics, paste, "<br>", collapse=""), c)
names(lec_topics_html) <- NULL
```
<!-- 1st is pdf, 2nd html, 3rd Rmd -->
```{r lec_links, include = FALSE}
# lec_links <- lapply(week_lecs, function(x){if(is.list(x)){c(x$rmd,x$pdf,x$ppt)}else{""}})
# ## topics formatted for html
# lec_links_html <- sapply(lapply(lec_links, function(x){ tmp1<-c("[Rmd](","[PDF](","[PPT]("); tmp2 <- c(")",")",")"); tmp1[x==""]=""; tmp2[x==""]=""; tmp <- paste(tmp1,x,tmp2); tmp=paste(tmp,collapse="<br>"); tmp}), c)
# names(lec_links_html) <- NULL
lec_links1 <- lapply(week_lecs, function(x){if(is.list(x)){c(x$rmd)}else{""}})
lec_links1_html <- sapply(lapply(lec_links1, function(x){
tmp1<-paste0("[Rmd ",1:length(x),"]("); tmp2 <- ")"; tmp <- paste(tmp1,x,tmp2); tmp[x==""]=""; tmp=paste(tmp, collapse=" "); tmp}), c)
lec_links2 <- lapply(week_lecs, function(x){if(is.list(x)){c(x$pdf)}else{""}})
lec_links2_html <- sapply(lapply(lec_links2, function(x){
tmp1<-paste0("[pdf ",1:length(x),"]("); tmp2 <- ")"; tmp <- paste(tmp1,x,tmp2); tmp[x==""]=""; tmp=paste(tmp, collapse=" "); tmp}), c)
lec_links3 <- lapply(week_lecs, function(x){if(is.list(x)){c(x$html)}else{""}})
lec_links3_html <- sapply(lapply(lec_links3, function(x){
tmp1<-paste0("[html ",1:length(x),"]("); tmp2 <- ")"; tmp <- paste(tmp1,x,tmp2); tmp[x==""]=""; tmp=paste(tmp, collapse=" "); tmp}), c)
lec_links_html <- lec_links3_html
for(i in 1:length(lec_links3_html)){
lec_links_html[i] <- paste(lec_links2_html[i], lec_links3_html[i], lec_links1_html[i], sep="<br>")
}
names(lec_links_html) <- NULL
```
```{r video_links, include = FALSE}
vid_links <- lapply(week_lecs, function(x){if(is.list(x)){x$video}else{""}})
## topics formatted for html
vid_links_html <- sapply(lapply(vid_links, function(x){
tmp1<-"[Video]("; tmp2 <- ")"; tmp <- paste(tmp1,x,tmp2); tmp[x==""]=""; tmp=paste(tmp,collapse="<br>"); tmp}), c)
names(vid_links_html) <- NULL
```
```{r youtube_links, include = FALSE}
youtube_links <- lapply(week_lecs, function(x){
if(is.list(x)){x$youtube}else{""}})
## topics formatted for html
youtube_links_html <- sapply(lapply(youtube_links, function(x){ tmp1<-"[YouTube]("; tmp2 <- ")"; tmp <- paste(tmp1,x,tmp2); tmp[x==""]=""; tmp=paste(tmp,collapse="<br>"); tmp}), c)
names(youtube_links_html) <- NULL
```
```{r reading_links, include = FALSE}
reading_links <- lapply(week_lecs, function(x){if(is.list(x)){x$reading}else{""}})
## topics formatted for html
reading_links_html <- sapply(lapply(reading_links, paste, "<br>", collapse=""), c)
names(reading_links_html) <- NULL
```
```{r instructors, include = FALSE}
instructors <- lapply(week_lecs, function(x){if(is.list(x)){x$instructor}else{""}})
## topics formatted for html
instructor_html <- sapply(lapply(instructors, paste, "<br>", collapse=""), c)
names(instructor_html) <- NULL
```
```{r generate_table, echo=FALSE}
## data frame with dates & topics
syl_txt <- data.frame(
date = qtr,
instructor = instructor_html,
lec_topics = lec_topics_html,
lec_links = lec_links_html,
vid_links = vid_links_html,
reading_links = reading_links_html
)
colnames(syl_txt) <- c("Date", "Instructor", "Lecture topics",
"Slides", "Video of Lecture", "Reading")
## generate table
kable(syl_txt, format = "html", caption = " ",
align = "cclccc", escape = FALSE) %>%
kable_styling(bootstrap_options = "striped",
full_width = F,
position = "left") %>%
column_spec(c(1,2), width = "4em") %>%
scroll_box(height = "700px", extra_css = "border-style: none;")
```