What is YAML?

The part inside — is the YAML (“Yet Another Markup Language”, then later “YAML Ain’t Markup Language”) header that is used to specify metadata (title, author etc) and also output (what kind of document, e.g. html_document, pdf_document)

  • notice the indentation for theme
  • YAML is very picky - be willing to make errors and google when things go wrong!

Themes in YAML

Some different themes: default, cerulean, journal, darkly, flatly, spacelab, cosmo, lumen, paper, sandstone, simplex, yeti, readable

How to make a table of contents

Under output, add an indentation and write toc: true If you want the table to ‘float’ (aka not disappear once you scroll down), then add toc_float: true

Plain markdown

This part of the document is plain markdown. I can make some things italics and other things bold.

  • I can make lists
  • just like before

Adding Chunks

In the next section I will add a “chunk” of R code:

print("hello world!")
## [1] "hello world!"

The part inside ```{r} is R code.

You can see that by default, the “knitted” document shows my code first, which is then followed by the output that R generates when this code is “executed”.

Inserting Maths Equations

Maths is written in LaTeX (when googling how to do something, google ‘how to write X in LaTeX’).

This \(x^2\) is inline. This equation is standalone. \[ a^2+b^2=c^2 \]

Rescorla-Wagner Model

The formula for the associative strength \(V\) at time \(t+1\) is given by \[ V^{t+1} = V^t + \Delta V \] Where \(\Delta V\) is given by \[ \Delta V = \alpha \beta (\lambda - V~tot~) \]

Dollar Signs

$ is text

$10 and $20 are text

$10 $ and $20 $ are text

\(10\) uses maths mode