Introduction to R Markdown
In this section, we’ll learn how to create reports using R Markdown.
R Markdown
R Markdown is a tool we use to create efficient reports to summarize analyses and communicate results to an audience. We can create HTML and PDF documents with R Markdown using only R code. R Markdown is also a way to ensure that the results are reproducible, which is important to guarantee when creating reports.
R Markdown elements
An R Markdown document is made of three components: the code, the text of the report, and the metadata for the file.
R Markdown file
The YAML header containing the metadata appears at the top of the file, followed by the contents that make up the report, including the text and code in code chunks. YAML is a syntax for hierarchical data structures that is commonly used for configuration files.
Knit
When we finish modifying a file and are ready to see the report, we’ll need to knit it. Knitting a file is how we generate an output file from the R markdown file. When a file is knit, R Markdown runs the chunks of R code contained in the file and combines them with the text in the document into an HTML file. For example, when the R Markdown file shown on the left is knit, it will create the output shown on the right.
Text Formatting
Headings
Linkes and Images
More Markdown Basics
You will find more about markdown here.