-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhomework.Rmd
144 lines (129 loc) · 4.51 KB
/
homework.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
---
title: "Assignments"
output: html_document
---
```{r child = "_timeline.Rmd", include=FALSE}
```
```{r child = "_list_of_hw.Rmd", include=FALSE}
```
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(magrittr)
library(kableExtra)
```
<br>
Students will have occasional assignments that will require them to demonstrate their knowledge of various course topics.
All assignments will be submitted, reviewed, and returned via GitHub.
```{r week_hw, include = FALSE}
## empty list for labs
week_hw <- vector("list", 8)
names(week_hw) <- paste0("L", seq(8))
## hw topics
week_hw$L1 <- github
week_hw$L2 <- forking_workflows
week_hw$L3 <- getting_help
week_hw$L4 <- data_viz # databases
week_hw$L5 <- publishing # data_viz
week_hw$L6 <- packages # publishing
week_hw$L7 <- databases # packages
week_hw$L8 <- presentations
```
```{r topics, include = FALSE}
topics <- lapply(week_hw, function(x) { if(is.list(x)) {c(x$topics)} else {""} })
## topics formatted for html
topics_html <- sapply(lapply(topics, paste, "<br>", collapse = ""), c)
names(topics_html) <- NULL
```
```{r assignment_links, include = FALSE}
assignment_links <- lapply(week_hw, function(x) { if(is.list(x)) {c(x$html)} else {""} })
assignment_links_html <- sapply(lapply(assignment_links, function(x) {
if(length(x)>1) {
tmp1 <- paste0("[",
as.character(fontawesome::fa("file-alt", height = "2em", fill = "#3399f3")),
" (", 1:length(x), ")](")
} else {
tmp1 <- paste0("[",
as.character(fontawesome::fa("file-alt", height = "2em", fill = "#3399f3")),
"](")
}
tmp2 <- ")"
tmp <- paste0(tmp1, x, tmp2)
tmp[x==""] <- ""
tmp <- paste(tmp, collapse="<br>"); tmp}), c)
```
```{r template_links, include = FALSE}
template_links <- lapply(week_hw, function(x) { if(is.list(x)) {c(x$rmd)} else {""} })
template_links_html <- sapply(lapply(template_links, function(x) {
if(length(x)>1) {
tmp1 <- paste0("[",
as.character(fontawesome::fa("file-code", height = "2em", fill = "#3399f3")),
" (", 1:length(x), ")](")
} else {
tmp1 <- paste0("[",
as.character(fontawesome::fa("file-code", height = "2em", fill = "#3399f3")),
"](")
}
tmp2 <- ")"
tmp <- paste0(tmp1, x, tmp2)
tmp[x==""] <- ""
tmp <- paste(tmp, collapse="<br>"); tmp}), c)
```
```{r data_links, include = FALSE}
data_links <- lapply(week_hw, function(x) { if(is.list(x)) {x$data} else {""} })
data_links_html <- sapply(lapply(data_links, function(x) {
if(length(x)>1) {
tmp1 <- paste0("[",
as.character(fontawesome::fa("table", height = "2em", fill = "#3399f3")),
" (", 1:length(x), ")](")
} else {
tmp1 <- paste0("[",
as.character(fontawesome::fa("table", height = "2em", fill = "#3399f3")),
"](")
}
tmp2 <- ")"
tmp <- paste0(tmp1, x, tmp2)
tmp[x==""] <- ""
tmp <- paste(tmp, collapse="<br>"); tmp}), c)
```
```{r key_links, include = FALSE}
key_links <- lapply(week_hw, 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("[",
as.character(fontawesome::fa("key", height = "2em", fill = "#3399f3")),
" (", 1:length(x), ")](")
} else {
tmp1 <- paste0("[",
as.character(fontawesome::fa("key", height = "2em", fill = "#3399f3")),
"](")
}
tmp2 <- ")"
tmp <- paste(tmp1, x, tmp2)
tmp[x==""] <- ""
tmp <- paste(tmp, collapse = " ")
tmp}), c)
names(key_links_html) <- NULL
```
```{r generate_table, echo=FALSE}
## data frame with dates & topics
syl_txt <- data.frame(
assign_date = sub("0(\\d)", "\\1", format(fri[2:9], "%d %b")),
due_date = sub("0(\\d)", "\\1", format(fri[2:9] + 9, "%d %b")),
topics = topics_html,
assignment_links = assignment_links_html,
# template_links = template_links_html,
data_links = data_links_html,
key_links = key_links_html
)
colnames(syl_txt) <- c("Assigned", "Due", "Topic(s)", "Instructions", "Data", "Answer key")
rownames(syl_txt) <- NULL
## generate table
kable(syl_txt, format = "html", caption = " ",
align = "cclccc", escape = FALSE) %>%
kable_styling(bootstrap_options = "striped",
full_width = FALSE,
position = "left") %>%
column_spec(c(1, 2), width = "6em") %>%
column_spec(c(4, 5), width = "7em") %>%
column_spec(6, width = "8em")
```