Formatting in R Markdown

Now that you have loaded your data into R, cleaned it up, and made some impressive looking plots, you probably want to show your analysis to someone else, who may or may not be an R user. R Markdown is a really easy way of creating analysis reports to share with others. It is also a useful tool for making sure that the analysis you do is well-documented and reproducible; use R Markdown and your future self will thank you.

In this lesson, we are going to walk through how to create a report using R Markdown, how to format text within your report, and add links, images, and gifs.

Lesson Outcomes

By the end of the lesson, you should be able to:

  • create a R Markdown document (.rmd file)
  • use heading levels to create your document structure
  • make text bold and italics, and use quotes
  • add links, images, tweets, and gifs to your report

How to create a R Markdown document and format text within it

In this screencast, we’ll cover:

  • How to create a R Markdown document and knit it into a report
  • How to use headings, bold, italics, and quotes within your report

Your turn to have a go

Watch the video and then carry out the following steps:

  1. Open a new R Markdown document and save it
  2. Knit the document
  3. Delete everything in the default template and knit it again
  4. Play around with headings, putting text in bold and italics, and adding quotes

Learn More

To learn more about formatting your R Markdown document, check out the R Markdown: The Definitive Guide, a free book written in bookdown, by Yihui Xie.

Next up in MarkyMark, lets talk about chunks. Head on to Lesson 2!