R markdown is a way of integrating the text of a document with R code that will be run each time you compile the document. Markdown is the format of the document text and, like HTML (but way simpler), lets you define some text as a headings, regular paragraphs, bullet lists, and more. In R markdown, you can also add chunks of code (called ‘chunks’) that are actually run with any output (plots, tables, or raw R output) written inline with the text. By default, it also echos the code to the document. You can compile R markdown documents to HTML, PDF, and word docs. It will change your life.
- R Studio tutorial on R markdown
- Datacamp tutorial on R Markdown
- Markdown syntax
- R markdown output formats and document options (click “Formats” for other formats)
- R chunk options
An example of the raw R markdown document and what it looks like when compiled: