- R Markdown: The Definitive Guide: https://bookdown.org/yihui/rmarkdown/
- RStudio Lessons: https://rmarkdown.rstudio.com/lesson-1.html
Markdown is a markup language for developing and formatting documents. R Markdown is an R-package that allows the user to integrate text, R-code, and R-code output into a well formatted document (e.g., HTML, MS Word, PDF).
My recommendation is to create an R Markdown file for every R-project. The intention is to document as much of the project as possible. R Markdown provides a more readable document, with better descriptions of how and why an activity was performed, than a standard R script with a few commented lines.
- Reproducible: Document steps of an investigation or scientific study
- Collaborative: Easy to work with others on investigations and scientific studies.
- Efficient: Generate and update reports automatically (e.g., HTML, MS Word, and PDF).
- Engaging: Embed interactive figures, maps, and tables in reports (HTML only).
4.2 Basic Overview
Use markdown syntax, some of which is shown in the table below, to format the document.
Once the document is complete (formatted with markdown syntax with integrated R code) the document can be knit (rendered) using the package knitr.
Here is a simple example showing the raw R Markdown (Rmd) file before knitting (rendering) and after knitting. The colors on the far left are there to help identify elements pre- and post-knitting.
R is not the only language supported by R Markdown. Languages supported by R Markdown include, but are not limited to,…