generated from jhudsl/OTTR_Template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
02-chapter_of_course.Rmd
186 lines (114 loc) · 4.29 KB
/
02-chapter_of_course.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# A new chapter
*If you haven't yet read the getting started Wiki pages; [start there](https://github.com/jhudsl/OTTR_Template/wiki/Getting-started)
Every chapter needs to start out with this chunk of code:
```{r, include = FALSE}
ottrpal::set_knitr_image_path()
```
## Learning Objectives
*Every chapter also needs Learning objectives that will look like this:
This chapter will cover:
- {You can use https://tips.uark.edu/using-blooms-taxonomy/ to define some learning objectives here}
- {Another learning objective}
## Libraries
For this chapter, we'll need the following packages attached:
*Remember to add [any additional packages you need to your course's own docker image](https://github.com/jhudsl/OTTR_Template/wiki/Using-Docker#starting-a-new-docker-image).
```{r}
library(magrittr)
```
## Subtopic
Here's a subheading and some text in this subsection!
### Code examples
You can demonstrate code like this:
```{r}
output_dir <- file.path("resources", "code_output")
if (!dir.exists(output_dir)) {
dir.create(output_dir)
}
```
And make plots too:
```{r}
hist_plot <- hist(iris$Sepal.Length)
```
You can also save these plots to file:
```{r}
png(file.path(output_dir, "test_plot.png"))
hist_plot
dev.off()
```
### Image example
How to include a Google slide. It's simplest to use the `ottrpal` package:
```{r, fig.align='center', echo = FALSE, fig.alt= "Major point!! example image"}
ottrpal::include_slide("https://docs.google.com/presentation/d/1YmwKdIy9BeQ3EShgZhvtb3MgR8P6iDX4DfFD65W_gdQ/edit#slide=id.gcc4fbee202_0_141")
```
But if you have the slide or some other image locally downloaded you can also use html like this:
<img src="resources/images/02-chapter_of_course_files/figure-html//1YmwKdIy9BeQ3EShgZhvtb3MgR8P6iDX4DfFD65W_gdQ_gcc4fbee202_0_141.png" title="Major point!! example image" alt="Major point!! example image" style="display: block; margin: auto;" />
### Video examples
To show videos in your course, you can use markdown syntax like this:
[A video we want to show](https://www.youtube.com/embed/VOCYL-FNbr0)
Alternatively, you can use `knitr::include_url()` like this:
Note that we are using `echo=FALSE` in the code chunk because we don't want the code part of this to show up.
If you are unfamiliar with [how R Markdown code chunks work, read this](https://rmarkdown.rstudio.com/lesson-3.html).
```{r, echo=FALSE}
knitr::include_url("https://www.youtube.com/embed/VOCYL-FNbr0")
```
OR this works:
<iframe src="https://www.youtube.com/embed/VOCYL-FNbr0" width="672" height="400px"></iframe>
### Links to files
This works:
```{r, fig.align="center", echo=FALSE}
knitr::include_url("https://www.bgsu.edu/content/dam/BGSU/center-for-faculty-excellence/docs/TLGuides/TLGuide-Learning-Objectives.pdf", height = "800px")
```
Or this:
[This works](https://genetics-gsa.org/education/genetics-learning-framework/).
Or this:
<iframe src="https://genetics-gsa.org/education/genetics-learning-framework/" width="672" height="800px"></iframe>
### Links to websites
Examples of including a website link.
This works:
```{r, fig.align="center", echo=FALSE}
knitr::include_url("https://yihui.org")
```
OR this:
![Another link](https://yihui.org)
OR this:
<iframe src="https://yihui.org" width="672" height="400px"></iframe>
### Citation examples
We can put citations at the end of a sentence like this [@rmarkdown2021].
Or multiple citations [@rmarkdown2021, @Xie2018].
but they need a ; separator [@rmarkdown2021; @Xie2018].
In text, we can put citations like this @rmarkdown2021.
### Callout boxes
There are some preset callout boxes available, which can be used like so:
`notice`:
::: {.notice}
Here's something interesting.
:::
`warning`:
::: {.warning}
Look out!
:::
`dictionary`:
::: {.dictionary}
Here's a definition.
:::
`reflection`:
::: {.reflection}
Consider this!
:::
`github`:
::: {.github}
Here's how you use GitHub.
:::
`wip`:
::: {.wip}
This section is a **Work in Progress**.
:::
### Dropdown summaries
<details><summary> You can hide additional information in a dropdown menu </summary>
Here's more words that are hidden.
</details>
## Print out session info
You should print out session info when you have code for [reproducibility purposes](https://jhudatascience.org/Reproducibility_in_Cancer_Informatics/managing-package-versions.html).
```{r}
devtools::session_info()
```