This template will show you the basics of an R Markdown document. R Markdown is a special file type with the .Rmd suffix. It is combination of text, Markdown, and R code. Once you’ve written an R Markdown document, you can “knit” the document to construct all kinds of nicely formatted documents, from reports in PDF (including APA style with the papaja package), to web pages in HTML, or Word documents.

Let’s go through the steps of creating your first R Markdown document. The main steps are as follows

  1. Create a new R Markdown (.Rmd) document.
  2. Write text with Markdown tags for formatting.
  3. Add R chunks, inline code, and tables
  4. Knit the R Markdown document to a final document in HTML, PDF, or Word format

Download the cheatsheet!

Before you do anything, you should open this very helpful cheatsheet written by RStudio available at

Create new Markdown document

An R Markdown document is a special document with the .Rmd suffix – unlike R documents which have the .R suffix.

Open a new blank R Markdown (.Rmd) document

To create a new R Markdown document in RStudio, click File – New File – R Markdown.