Chapter 2 R Markdown crash course

But first: A crash course in R Markdown

In Spring 2018 at R-Ladies #LdnOnt we practiced making a manuscript using RMarkdown (slides). Today we will up the ante and write a whole4 dissertation using R Markdown!

2.1 Markdown syntax basics

You can write plain old text like this, or you can make italic text by encasing it in single underscores or asterisks (*like this!*), bold text by surrounding it with two (**like this!!**) or bold and italic by surrounding it with three (***like this!!!***).

Paragraph breaks are indicated by a double line break. Single line breaks don’t create new paragraphs, and this can be useful to make your writing easier to read.

Links are written by including the text in square brackets followed by the URL in parenthesis: [text](path/to/url/).

Headers are easy!

They are denoted with hash marks:

# First level header

## Second level header

### Third level header

Lists

Lists can be unordered by using hyphens or asterisks

- Item 1
- Item 2
  - Item 2b
  • Item 1
  • Item 2
    • Item 2b

Lists can be ordered by using numbers, but it doesn’t matter what numbers you use, only what number you start with!

1. Item 1
5. Item 2
  1. Item 1
  2. Item 2

Watch out for white space! A line break is needed for the list to start.

R code

R code can be included in chunks. A chunk can be inserted via the Source pane or by typing Cmd Option k. They look like this:

```{r chunk-label, eval=TRUE}
# Comments in R need a hash mark in front of them
x <- 2
```

Exercise 1

Get up and running with R Markdown and R Projects: Do exercise 1 in Section 9.1


  1. More like a smidgen than a whole, really.