::render("lotr.Rmd", output_format = "html_document") rmarkdown
2 Output Formats
2.1 Section Outline
The section will showcase the different output formats you can create from the same document.
Teaching Time: 5 Minutes
Working Time: 5 Minutes
2.2 Generating Output
2.2.1 Knit
You can select the type of output you would like when you “knit” the document. This is just the final stage of the process when you are letting RStudio know what you want to create.
2.2.2 render
Instead of using the GUI, we can instead use the console to create our document. The type of documents we can create are as follows:
html_document
pdf_document
word_document
By typing the following into console, we can compile our RMarkdown document:
2.3 YAML
For ease of use, it is often best to define what type of document you would like to create in the text file. This can be done by adding the following to your YAML header
title: "Lord of the Rings"
ouput: html_document
2.4 Exercise
Attempt to generate all three types fo reports:
- HyperText Markup Language (.html)
- Portable Document Format (.pdf)
- Microsoft Word (.docx)