In addition to HTML and Word documents, you can also customize PDF documents. Creating PDF documents is optional, but if you have like LaTeX installed, let's try creating a PDF document and experiment with changing the YAML options to customize your PDF document. You can learn more about these customizations on the R Markdown website for PDF documents. It's worth noting that PDF documents do have an option to create a table of contents, just like the HTML document. But the table of contents option is not available for the Word document format. So not all options for customizing your documents are interchangeable across all formats. PDF documents can further be customized using external LaTeX, T-E-X, or TeX documents, similar to the Word reference template or the cascading style sheets that we use for HTML documents. Creating these custom TeX templates is beyond the scope of this course. However, at the end of the course, you're going to see some demonstration of what's possible using existing custom TeX templates. Luckily, other people have already created some very useful custom templates that are easy and ready to use. So we just saw how to customize Word documents for the DOCX document format. And to fully customize a DOCX format, it is assumed that you have access to and use the Microsoft Word software. However, in RStudio for R Markdown documents, we also have the option to create ODT, for Open Document Text, and RTF, for Rich Text Format documents, and these are not dependent on a single software platform. So let's go ahead and create an ODT document. To get this format we need to make some changes to the YAML header. So in RStudio let's create a new HTML document under File > New File > R Markdown. And we'll create an HTML document. In the title, though, we're going to call this an ODT document, and click OK. However, in the YAML header, the output key word still shows HTML document. We need to change this from HTML document to ODT document. Let's click Save, and we'll give this a file name, ODT Document. Make sure that you're saving it in your Module3 project directory. Now that we have this saved, if you click on Knit, you'll notice that it now says Knit to ODT document, not HTML. Go ahead and click Knit to ODT document. You will see the result here in the preview window. You should be able to view this ODT document in a compatible document software like Microsoft Word or Google Docs. If you have access to Google Docs, we can actually upload the ODT document that we just created and view it in the Google Docs software. Once the file uploads, as you can see here, in a browser window I can now view and edit my ODT document using Google Docs. Let's make one more change. Instead of doing an ODT document, let's do an RTF or rich text formatted document. So now that you have the ODT document open, let's save this under a different name. So we'll click Save As and change it from ODT, To RTF. Click Save. After we've saved the file as an RTF document, we changed the output in the YAML header from ODT to RTF. Let's also change the title to an RTF document. We'll click Save, and then Knit to RTF document. This will open in a preview window. So here's the document in the preview window. And you'll notice it looks very similar to the ODF document with a few slight differences. Again, if you have Google Docs, you can view and edit the RTF document in Google Docs. There are several other formats contributed by the R user community. Back at the R Markdown website, you'll notice that there's a listing here for a bunch of different formats. We've covered most of the document formats and the presentation formats. However, if you scroll to the bottom of the web page, there is a list here of these different formats submitted from the R community. So the html_pretty template here comes from the pretty_docs R package. And the next three, readthedown, html_docco, and html_clean all come from the RMD formats R package. Let's test some of these out. To gain access to these community formats, however, we first need to install the R packages that they come from. So let's go back to RStudio. To install packages, we need to click on Tools > Install Packages. The first one we're going to take a look at is the prettydocs package. If we type this in here for the package name, you'll notice that I'm asking to install this from the crayon repository. Once you have that listed, click on Install. Once the package installs, you should now have access to the R Markdown templates that were included with this package. To verify that, go to File > New File > R Markdown. But now, instead of documents or presentations, we're going to click on From Template. And you'll notice if I scroll down, on the left-hand side is the name of the template. And on the right-hand side is the package that the template comes from. There are two listed here from the prettydoc package. The first one says Lightweight and Pretty Document HTML. Click on that one and then click OK. This creates a new R Markdown file with the HTML pretty document template. You'll notice at the top that this template defaults to a theme called architect with a highlight option set to GitHub. To see what these themes look like, there's a link on the R Markdown format's web page. So if I click on html_pretty here on the web page, this opens another website with information specifically on the prettydoc package. If we scroll down just a little bit, you'll see that it shows the listing of the different themes. There are three, Cayman, Tactile, and Architect. The first shown here is Cayman, the next one is Tactile, and the last one is Architect. So let's go back to RStudio. We'll leave the settings as they are, go ahead and save your file, and we'll call this htmlpretty, and click Save. And then when you click on the Knit button, the option that is shown is Knit to html_pretty. So when this opens in the viewer window, you now have an HTML document done in the html_pretty template format. Let's make a change, and let's change the theme to Tactile in the YAML header. We'll leave the highlight as GitHub. Save the file, and go ahead and Knit to html_pretty. And you should see the template format here change from Architect to Tactile. Next, let's take a look at what's available in the RND format for R package. So go ahead and click on Tools > Install Packages, and type in rndformats. Again, we're installing this from the crayon repository. Click Install. Once the RND package is installed, you're going to have access to the R Markdown templates available from that package. Click on File > New File > R Markdown. Click on the From Template tab, and again, if I scroll down just a little bit you'll now see that there are a number of different templates that are available from the RND formats package. Let's try to read the down template, which is down here a little bit further. So click on the one that says HTML readthedown template, and click OK. You'll notice that not all of the YAML header is filled out. Specifically, the title is left blank. So let's add a title for our document. We'll just say, Readthedown Template. Let's also add your author name. You'll notice here for the date keyword, there's some R code that's pulling the current system date. Now that you've updated your YAML header, go ahead and just click Save. And we'll call this readthedown, and click Save. And you'll notice as you look through, there's very little information given. This template is very basic and bare bones. We need to add content here to really appreciate the functionality of this template. So let's add a few sections to the document. Take a few moments to type in what you'd like to see, or cut and paste sections from other R Markdown documents that you've created. For example, I've brought over some of the basic R Markdown template shown here. Click Save. And then go ahead and click Knit to Readthedown. When this opens in the viewer window, you'll notice that this creates a nice HTML document with a floating table of contents. Let's also open this HTML file in a browser to fully appreciate the functionality of this new HTML template. So if I open readthedown.html in my browser window, you can now see the interaction of the floating table of contents shown here. If you wish to access these new HTML documents as web page served from GitHub, remember you need to move copies of these HTML files into your docs directory, and then you can view them online. Let's go ahead and back everything up to your GitHub account. Make sure you're in the RepTemplates/Module3 directory, and let's add the files that we just created. And we'll commit them with a commit statement, add new html formats. And we'll push everything up to the cloud. Type in get status, just to double-check, there's nothing to commit, and your work entry is clean. Go back to your GitHub account from Module3, click Refresh, and you should now see all of the new files that we just created.