Example Chapter

Every chapter needs to start out with this chunk of code:

ottrpal::set_knitr_image_path()

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
dev.off()

Image example

How to include a Google slide.

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:

Major point!! example image

Video examples

You can use knitr::include_url() like this:

knitr::include_url("https://www.youtube.com/embed/VOCYL-FNbr0")

OR this works:

Links to files

This works:

knitr::include_url("https://www.messiah.edu/download/downloads/id/921/Microaggressions_in_the_Classroom.pdf", height = "800px")

Or this:

This works.

Or this:

Links to websites

Examples of including a website link.

This works:

knitr::include_url("https://yihui.org")

OR this:

Another link

OR this:

Citation examples

We can put citations at the end of a sentence like this [@R-bookdown]. Or multiple citations [@R-bookdown, @R-rmarkdown].

but they need a ; separator [@R-bookdown, @R-rmarkdown].

In text, we can put citations like this @R-rmarkdown.

Print out session info

sessionInfo()


jhudsl/ottr documentation built on April 12, 2025, 8:54 p.m.