So if you need to, go ahead and log back into your GitHub account, then open RStudio and open the project for module two, RMD one. We're going to keep working with the R Markdown file that you just created. Previously, we discussed the YAML header contains the title, author, date, and output format. But now, we're going to concentrate on the text in the main body of your document. You're going to learn some syntax on how to format different parts of your text in different ways. So let's start at the top. For now, we're going to ignore the part in between these three backticks with the part that says R setup and that's may be shown in a highlighted grey box. This is a chunk of R code and we're going to be discussing that a little bit later. So let's start with the section that begins with two hashtags followed by the text R Markdown. The hashtags are Markdown syntax, and that's used to indicate that the text that follows is a header, and the number of hashtags indicates the level that the header should be. For example, two hashtags indicate that the word "R Markdown" should be formatted and treated as a level two header. Let's take an overview look at the R Markdown syntax. In RStudio, you can click on help, and then, click on the R Markdown Quick Reference, and it'll show you some of the examples here of the different kinds of syntax. There are also cheat sheets that you can look up. If you click on Help, Cheatsheets, there's one here for the R Markdown Cheat sheet and it brings it up in a website with some information on Markdown. The R Markdown Cheat sheet is shown here. It's actually a PDF document and it has information on the different parameters and types of syntax that you can do with R Markdown. You can also learn more information about R Markdown and the Markdown basics on their website. And it has an example of the different kinds of Markdown here on the left with a demo on the right. And on this site, there's additional links here on the Markdown syntax used by Pandoc. So I mentioned Pandoc in module one as the universal document converter. When we process or compiled the R Markdown document using the Markdown package in R, it uses Pandoc to process the document into the final desired formats. So it's important to understand how formatting syntax works, that way there Pandoc understands it. So, let's try out some of the basic Markdown syntax to get you started formatting the text the way that you wanted. So, go ahead and open back up your R Markdown document. Let's try adding a level one and a level three header. So right before the two hashtags for R Markdown, let's add a single hashtag and type in 'This is a level one header.' And then after the two hashtags for R Markdown, let's put in a level three header with three hashtags, 'This is a level three header.' Go ahead and save, and let's knit to HTML so that you can see the result in the viewer. So now you'll see after the title, author, and date, we have a level one, a level two, and a level three header shown here in the preview window. Next, if you scroll down just a little bit further in your R Markdown document, you'll notice that there is a URL or web address shown between the less than-greater than symbols. This is one way to add a weblink, by using these less than-greater than symbols. It's an abbreviated shorthand of HTML, and that is allowed. However, the markdown syntax for adding a link is to put the word or words that you want to highlight between square brackets, followed immediately by the web address in parentheses. So let's add this to your document. 'Here is a link to google.' And we're going to put the word Google in square brackets followed by the web address in parentheses. So go ahead and save this and click Knit to HTML. So from the Viewer Window, you should now see 'Here is a link to google.' And you'll notice that the word Google, now is a hypertext link. If we click on it, it should open the link to google in your web browser. In the next paragraph, the word Knit has two asterisks, both at the beginning and at the end of the word. These are used for emphasis. Two asterisks are used for strong emphasis, which results in the word being formatted in bold. If we only used one asterisk, the word would be shown in a italics, and you can also do the same thing using one or two underscores to emphasize a word. So let's add two more lines of text and test this out. So for example, 'Here is a word in bold' with two asterisks in front of it 'and another word in bold' but this time we use two underscores both in front and after it, and let's do the same thing again but make it italics. So 'Here is a word in italics and another word in italics' using either a single asterisk or a single underscore. Again, save the file, Knit to HTML to see the results. So notice that the asterisks or underscore must come immediately before and after the word with no spaces in between for the syntax to work. Other kinds of emphasis can also be added using backtick marks before and after a word or series of words. And this is usually done to highlight text that refers to often a computer code or command. The text is place between two backtick marks and is normally formatted in a non-proportional font and is sometimes highlighted in a different color like a light grey. So let's add this line of text and put the name of the R Markdown package between two backtick marks: 'When we compile our document, we are using the rmarkdown package.' And we'll put the backtick right before the R and right after the N. Again, save it, and Knit to HTML to see the result. So now you can see that the word Rmarkdown, not only is in a different font but it's also highlighted in a light grey box. We can extend this concept by highlighting a whole block of text to be shown in non-proportional font, between three backticks on separate lines both at the beginning and end of the text block that you want to highlight. So we could type in the following: 'Here are some example R commands:' We start with three backtick marks and end with three backtick marks, and in-between, we could type in the R code two plus two or something like, finding the mean of a series of numbers, click save, and click Knit to HTML so you can see the result. You'll notice that these two lines, two plus two and then the mean function that we typed in, are shown in proportional font and they are also highlighted here in a light box. There's one thing I need to point out. Putting text between three backticks only changes the formatting of that text. It looks very similar to an R code junk, but it doesn't have the little R between curly brackets after the first three backticks. We'll cover the R code junks a little bit later. Let's also make a bulleted list. We can make non-numbered bullets by using asterisks, and dashes, and the plus symbol. So let's try to make the following list. To make a line indented, you're going to add four spaces and if you want to indent twice, you add eight spaces, and so on. This is the four space rule. So let's type in the following: 'Here is an example of a non-numbered list:' We put the word Breakfast after a single asterisk, indent in fourth spaces and put a dash by the word Food, and then we indent eight spaces and put in a plus similarly for Eggs, Toast and Bacon. And now, we've got Drink, an Apple juice. We've got a list here for Lunch and Dinner. So let's go ahead and save this and Knit to HTML so you can see the result. So here's the resulting non-numbered list. So we can make the same list numbered, but now by using numbers and letters. So here's the example of that same list, but this time using numbers and letters. Let's save that and Knit to HTML so you can see the result. So here's the same list again, but this time with numbers instead of just symbols. You can also format quotes within R Markdown using block quotes, and they're highlighted at the beginning of each line in the quote with a greater than symbol. 'Here is an example of a block quote.' Notice that each line starts with a greater than symbol and even within a block quote, I can have a list, and that is shown here. Let's save and Knit to HTML to see the result. So here's the result in block quote. You'll notice that it's indented a little bit and there's a little slight grey line shown here, highlighting that this is a standalone quote. You can also nest a block quote and you do this by adding two greater than symbols. So, 'Here is an example of a nested block quote.' And you notice that on this last line, I have two greater than symbols. There is a space between each of the greater than symbols, that way there R Markdown knows that this text is to be nested inside of the previous text. By Knit to HTML, you can see the result. You can also embed code within a block quote. To indent code within a block quote, you need five spaces after the greater than symbol, shown here. Let's Knit to HTML and you can see the result. Again, we get code separated out and highlighted in a non-proportional font. It's highlighted in a box, but this time, it's indented similar to the other block quotes that you did previously. Let's also try knitting to Word and optionally knitting to PDF, if you have LaTeX installed, to see how each of these various text formatting syntaxes appear in the final documents. Let's do first Knit to Word. Most everything here shown in the Word document is as you would expect. There's a level one header, our level two header and our level three header. We've got hypertext links here for the two different websites that we had put in. The words that we wanted shown in bold and italics show up correctly. The word Rmarkdown that we had blocked off in non-proportional font using backticks also shows up correctly here. The R code is separated. The non-numbered list looks correct, as well as the numbered list. However, the block quotes look a little bit different. They do show up in a different font in a slightly different font size, but they're not indented. So not all syntax works exactly the same in every document format. So you'll notice with the PDF document, things are pretty much as we would expect. We can see the differences here and the different level one, two, and level three headers. The links for the different URLs for the websites, those show up as hyperlinked. R words in bold and italics look correct. The non-proportional font for R Markdown looks correct. The R commands are separated out. Our bulleted list look correct. And our block quotes are indented. Again, they look a little bit different than they do in HTML, but this is a PDF document, so that's to be expected. So now that we've made a bunch of changes, let's remember to stage, commit, and push your changes up to your GitHub account. Open Git Bash and go ahead and change the directory to the GitHub repository that you created for module two RMD one. Once you're in this directory, let's type in the following four Git commands and check the status of your local files compare to your GitHub cloud repository. So the first command is git status, and this shows that we do have several files that have been created or modified since our last commit. So let's add or stage the files to be committed. And then, we'll add in a comment, 'new files for module 2 rmd 1.' And then, go ahead and push everything up to the cloud. If you like, you could type 'git status' one more time just to double check, and it should say that everything is up to date and your working tree is clean. Finally, you can go back to your GitHub repository and click Refresh, and you should now have everything backed up that we just completed.