The words title, author, date, and output are all YAML keywords, and
these are parameters or options used by the render function
in the R Markdown package to compile and create the final document.
After each keyword there's a colon followed by the input that you gave it.
For example, your title input is in quotation marks and
it says, "Module2 R Markdown Document 1".
Similarly, on the next line you have a keyword author followed by a colon and
then your name in double quotation mark.
Likewise, you have the same thing for the date.
Currently, though,
the last line of the YAML header has the keyword output html_document.
And this was defined when we first created the new file R Markdown document.
We're going to be learning a lot more about this YAML keyword for
output because this is where we define the parameters for
customizing the various output formats that we want.
For now, watch what happens when we select different knit options.
First, let's knit to HTML.
When you do this your document should open in the Viewer window which is shown on
the bottom right.
If for some reason your document does not appear in the Viewer window
check your knit options, click the gear icon next to the knit.
And notice there are two different options here,
one is Preview in Viewer Pane, which I'm doing currently,
if click Preview in Window, it simply moves it to a new separate window.
For now, I'm going to switch it back to Preview in Viewer Pane.
So now, let's knit to Word and create a docx formatted file.
If you click the little arrow next to the knit button you'll see
the different options.
And if we do click Knit to Word, you'll notice that a couple things happen.
The YAML header was changed automatically, and
this is one example of how changing the options in your YAML header
directly affects the output produced from your R Markdown document.
And here is the example of the document shown in a different kind of viewer window
for Microsoft Word docx format.
Optionally, if you have LaTeX installed in your computer you can also try
Knit to PDF.
And again, this will open in any window to preview the PDF document.
And your YAML header will change once again and
include pdf_document as an option for the output.
Here is a preview of the PDF document.
We're going to be adding and
removing more YAML keywords as we go through this course.
Go ahead and keep this R Markdown file open for the next lesson.