Chapter 3 Topic of Section

You can write all your text in sections like this!

3.1 Subtopic

Here’s a subheading and some text in this subsection!

3.1.1 Code examples

You can demonstrate code like this:

output_dir <- file.path("resources", "code_output")
if (!dir.exists(output_dir)) {
  dir.create(output_dir)
}

And make plots too:

hist_plot <- hist(iris$Sepal.Length)

You can also save these plots to file:

png(file.path(output_dir, "test_plot.png"))
hist_plot
## $breaks
## [1] 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0
## 
## $counts
## [1]  5 27 27 30 31 18  6  6
## 
## $density
## [1] 0.06666667 0.36000000 0.36000000 0.40000000 0.41333333 0.24000000 0.08000000
## [8] 0.08000000
## 
## $mids
## [1] 4.25 4.75 5.25 5.75 6.25 6.75 7.25 7.75
## 
## $xname
## [1] "iris$Sepal.Length"
## 
## $equidist
## [1] TRUE
## 
## attr(,"class")
## [1] "histogram"
dev.off()
## png 
##   2

3.1.2 Image example

How to include a Google slide. It’s simplest to use the ottrpal package:

Major point!! example image

But if you have the slide or some other image locally downloaded you can also use html like this:

Major point!! example image

3.1.3 Video examples

To show videos in your course, you can use markdown syntax like this:

A video we want to show

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.

OR this works:

3.1.6 Citation examples

We can put citations at the end of a sentence like this (Allaire et al. 2021). Or multiple citations Xie, Allaire, and Grolemund (2018).

but they need a ; separator (Allaire et al. 2021; Xie, Allaire, and Grolemund 2018).

In text, we can put citations like this Allaire et al. (2021).

3.1.7 FYI boxes

Please click on the subsection headers in the left hand navigation bar (e.g., 2.1, 4.3) a second time to expand the table of contents and enable the scroll_highlight feature (see more).

References

Allaire, JJ, Yihui Xie, Jonathan McPherson, Javier Luraschi, Kevin Ushey, Aron Atkins, Hadley Wickham, Joe Cheng, Winston Chang, and Richard Iannone. 2021. Rmarkdown: Dynamic Documents for r. https://github.com/rstudio/rmarkdown.
Xie, Yihui, J. J. Allaire, and Garrett Grolemund. 2018. R Markdown: The Definitive Guide. Boca Raton, Florida: Chapman; Hall/CRC. https://bookdown.org/yihui/rmarkdown.