-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomp_labs.Rmd
129 lines (111 loc) · 5.16 KB
/
comp_labs.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
---
title: "Computer Labs"
output: html_document
---
[Link to Lab Book](https://nwfsc-timeseries.github.io/atsa-labs/chap-mlr.html)
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r include=FALSE}
library(kableExtra)
load("syllabus.RData")
```
```{r topics, include = FALSE}
lab_topics <- lapply(week_labs, function(x){if(is.list(x)){x$topics}else{""}})
## topics formatted for html
lab_topics_html <- sapply(lapply(lab_topics, paste, "<br>", collapse=""), c)
names(lab_topics_html) <- NULL
```
<!-- first is PDF, 2nd PPT, 3rd Rmd -->
```{r lec_links, include = FALSE}
# lab_links <- lapply(week_labs, function(x){if(is.list(x)){c(x$pdf, x$rmd)}else{""}})
# ## topics formatted for html
# lab_links_html <- sapply(lapply(lab_links, function(x){ tmp1<-c("[PDF](","[Rmd]("); tmp2 <- c(")",")"); tmp1[x==""]=""; tmp2[x==""]=""; tmp <- paste(tmp1,x,tmp2); tmp=paste(tmp,collapse="<br>"); tmp}), c)
# names(lab_links_html) <- NULL
lab_links1 <- lapply(week_labs, function(x){if(is.list(x)){c(x$rmd)}else{""}})
lab_links1_html <- sapply(lapply(lab_links1, function(x){
tmp1<-paste0("[Rmd ",1:length(x),"]("); tmp2 <- ")"; tmp <- paste(tmp1,x,tmp2); tmp[x==""]=""; tmp=paste(tmp, collapse=" "); tmp}), c)
lab_links2 <- lapply(week_labs, function(x){if(is.list(x)){c(x$pdf)}else{""}})
lab_links2_html <- sapply(lapply(lab_links2, function(x){
tmp1<-paste0("[PDF ",1:length(x),"]("); tmp2 <- ")"; tmp <- paste(tmp1,x,tmp2); tmp[x==""]=""; tmp=paste(tmp, collapse=" "); tmp}), c)
lab_links3 <- lapply(week_labs, function(x){if(is.list(x)){c(x$html)}else{""}})
lab_links3_html <- sapply(lapply(lab_links3, function(x){
tmp1<-paste0("[html ",1:length(x),"]("); tmp2 <- ")"; tmp <- paste(tmp1,x,tmp2); tmp[x==""]=""; tmp=paste(tmp, collapse=" "); tmp}), c)
lab_links_html <- lab_links3_html
for(i in 1:length(lab_links3_html)){
lab_links_html[i] <- paste( lab_links1_html[i], lab_links2_html[i], lab_links3_html[i], sep="<br>")
}
names(lab_links_html) <- NULL
```
```{r video_links, include = FALSE}
vid_links <- lapply(week_labs, function(x){if(is.list(x)){x$video}else{""}})
## topics formatted for html
vid_links_html <- sapply(lapply(vid_links, function(x){ tmp <- paste("[Video](",x,")<br>", collapse=""); tmp[x==""]=""}), c)
names(vid_links_html) <- NULL
```
```{r youtube_links, include = FALSE}
youtube_links <- lapply(week_labs, 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 data_links, include = FALSE}
data_links <- lapply(week_labs, function(x){if(is.list(x)){x$data}else{""}})
## topics formatted for html
data_links_html <- sapply(lapply(data_links, function(x){ tmp1<-paste("[",x,"]("); tmp2 <- rep(")",length(x)); tmp1[x==""]=""; tmp2[x==""]=""; tmp <- paste(tmp1,x,tmp2); tmp=paste(tmp,collapse="<br>"); tmp}), c)
names(data_links_html) <- NULL
```
```{r homework, include = FALSE}
hw_links <- lapply(week_labs, function(x){if(is.list(x)){x$homework}else{""}})
## topics formatted for html
hw_links_html <- sapply(lapply(hw_links, paste, "<br>", collapse=""), c)
names(hw_links_html) <- NULL
```
```{r duedate, include = FALSE}
duedate_links <- lapply(week_labs, function(x){if(is.list(x)){x$hw_duedate}else{""}})
## topics formatted for html
dd_links_html <- sapply(lapply(duedate_links, paste, "<br>", collapse=""), c)
names(dd_links_html) <- NULL
```
```{r key_links, include = FALSE}
# key_links <- lapply(week_labs, function(x){if(is.list(x)){x$key}else{""}})
# ## topics formatted for html
# key_links_html <- sapply(lapply(key_links, function(x){ if(identical(x, "")){""}else{ paste("[Key](",x,")", collapse="<br>")}}), c)
# names(key_links_html) <- NULL
key_links <- lapply(week_labs, function(x){if(is.list(x)){c(x$key)}else{""}})
key_links_html <- sapply(lapply(key_links, function(x){
if(length(x)>1){
tmp1<-paste0("[Key ",1:length(x),"](") }else{ tmp1<-"[Key](" }; tmp2 <- ")"; tmp <- paste(tmp1,x,tmp2); tmp[x==""]=""; tmp=paste(tmp, collapse=" "); tmp}), c)
names(key_links_html) <- NULL
```
```{r instructors, include = FALSE}
instructors <- lapply(week_labs, 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,
lab_topics = lab_topics_html,
lab_links = lab_links_html,
data_links = data_links_html,
vid_links = vid_links_html,
youtube_links = youtube_links_html,
hw_links = hw_links_html,
# duedate_links = dd_links_html,
key_links = key_links_html
)
colnames(syl_txt) <- c("Date", "Instructor", "Topics", "Lab", "Data",
"Video", "YouTube", "Homework", "Key")
## generate table
kable(syl_txt, format = "html", caption = " ",
align = "cclccccccc", escape = FALSE) %>%
kable_styling(bootstrap_options = "striped",
full_width = F,
position = "left") %>%
column_spec(1, width = "8em")
```