E.4 Summary

This appendix provided an introduction to R Markdown (J. Allaire et al., 2020), which implements a notion of literate programming (Knuth, 1984) in R. Essentially, R Markdown allows mixing text and code in an input document (an .Rmd file) and merges (or “knits”) the formatted text and evaluated code results in a separate output document (e.g., an .html file).

An R Markdown document consists of 3 parts:

  1. A header for setting global document options,
  2. Text that may contain headings, paragraphs, and itemized lists, and
  3. Code chunks that contain and evaluate R code.

Fortunately, the range of commands required to benefit from R Markdown is very limited. For instance, the commands in the help file Help > Markdown Quick Reference of R Studio provide a good start for creating beautiful and functional documents. Beyond these basics, the R Markdown Cheatsheet — also available in R Studio by selecting Help > Cheatsheets > R Markdown Cheat Sheet — provides a more comprehensive overview of R Markdown functionality and commands:

R Markdown summary from [R Studio Cheat Sheets](https://www.rstudio.com/resources/cheatsheets/).

Figure E.1: R Markdown summary from R Studio Cheat Sheets.

Finally, the following Section E.5 points to resources that provide information on more advanced uses of R Markdown.

References

Allaire, J., Xie, Y., McPherson, J., Luraschi, J., Ushey, K., Atkins, A., … Iannone, R. (2020). rmarkdown: Dynamic documents for R. Retrieved from https://CRAN.R-project.org/package=rmarkdown

Knuth, D. E. (1984). Literate programming. The Computer Journal, 27(2), 97–111. https://doi.org/10.1093/comjnl/27.2.97