-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase_html.Rmd
143 lines (121 loc) · 4.68 KB
/
base_html.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: "Question base <br> `r Sys.Date()`"
output: html_document
params:
qa: NA
n_list: NA
---
<!-- css settings -->
<style type="text/css">
body{ /* Normal */
font-size: 10pt;
}
td { /* Table */
font-size: 8px;
}
h1.title {
font-size: 18pt;
color: BlueRibbon;
text-align: center;
}
h1 { /* Header 1 */
font-size: 28px;
color: DarkBlue;
}
h2 { /* Header 2 */
font-size: 22px;
color: DarkBlue;
}
h3 { /* Header 3 */
font-size: 18px;
font-family: "Times New Roman", Times, serif;
color: DarkBlue;
}
code.r{ /* Code block */
font-size: 12px;
}
pre { /* Code block - determines code spacing between lines */
font-size: 14px;
}
</style>
```{r echo = FALSE, comment = NA, message = FALSE}
library(dplyr)
library(tidyr)
library(purrr)
library(readr)
#library(knitr)
library(pander)
```
<br>
```{r echo = FALSE, comment = NA}
base_list <- params$qa %>% arrange(Chapter, Level)
k <- 0
add_base_list <- list()
for(i in unique(base_list$Question_number)){
k <- k + 1
current_question <- base_list %>% filter(Question_number == i)
current_chapter <- current_question$Chapter[1]
current_level <- current_question$Level[1]
if(k == 1){
reference_chapter <- current_chapter
reference_level <- current_level
add_base_list[[k]] <- paste("<b>", reference_chapter, "</b>:<br><br>",
"<b>", reference_level, "</b>:<br><br>",
k, ". ",
current_question$Question[1],
"<br>a) ", current_question$Possible_answers[1],
"<br>b) ", current_question$Possible_answers[2],
"<br>c) ", current_question$Possible_answers[3],
"<br>d) ", current_question$Possible_answers[4],
"<br>e) ", current_question$Possible_answers[5],
"<br>Correct: ", current_question$Answer[1],
"<br><br>",
sep = "")
}else{
if(current_chapter == reference_chapter){
if(current_level != reference_level){
reference_level <- current_level
add_base_list[[k]] <- paste("<b>", reference_level, "</b>:<br><br>",
k, ". ",
current_question$Question[1],
"<br>a) ", current_question$Possible_answers[1],
"<br>b) ", current_question$Possible_answers[2],
"<br>c) ", current_question$Possible_answers[3],
"<br>d) ", current_question$Possible_answers[4],
"<br>e) ", current_question$Possible_answers[5],
"<br>Correct: ", current_question$Answer[1],
"<br><br>",
sep = "")
}else{
add_base_list[[k]] <- paste(k, ". ",
current_question$Question[1],
"<br>a) ", current_question$Possible_answers[1],
"<br>b) ", current_question$Possible_answers[2],
"<br>c) ", current_question$Possible_answers[3],
"<br>d) ", current_question$Possible_answers[4],
"<br>e) ", current_question$Possible_answers[5],
"<br>Correct: ", current_question$Answer[1],
"<br><br>",
sep = "")
}
}else{
reference_chapter <- current_chapter
reference_level <- current_level
add_base_list[[k]] <- paste("<b>", reference_chapter, "</b>:<br><br>",
"<b>", reference_level, "</b>:<br><br>",
k, ". ",
current_question$Question[1],
"<br>a) ", current_question$Possible_answers[1],
"<br>b) ", current_question$Possible_answers[2],
"<br>c) ", current_question$Possible_answers[3],
"<br>d) ", current_question$Possible_answers[4],
"<br>e) ", current_question$Possible_answers[5],
"<br>Correct: ", current_question$Answer[1],
"<br><br>",
sep = "")
}
}
}
kable(params$n_list) %>% kable_styling(bootstrap_options = c("striped", "hover"))
pander(add_base_list %>% unlist %>% cat)
```