Equations

Mathematics notation is easy to incorporate into an R Markdown document. Equations, Greek letters, and symbols can be included “inline” in sections delimted by $ … $ (e.g., The mean is $ \bar{x} = 3.2 $ \(\rightarrow\) The mean is \(\bar{x} = 3.2\)). Using sections delimited by two dollar signs ($ $ … $ $) will place the mathematical notation in display-mode as a separate paragraph.

Raw markdown Knitted
x^y \(x^y\)
x_y \(x_y\)
\alpha, \mu, \sigma \(\alpha, \mu, \sigma\)
\beta, \beta_0, \beta_1 \(\beta, \beta_0, \beta_1\)
\bar{x} \(\bar{x}\)
\hat{x} \(\hat{x}\)
\sqrt{x} \(\sqrt{x}\)
\sum \(\sum\)
\frac{x}{y} \(\frac{x}{y}\)

Displaying Blocks of Code Without Knitting/Evaluating

In some situations, you want to display text and R code without evaluating the R code. This is done by placing the code inside two sets of ``` (You can see this in the .Rmd file).

This text is displayed verbatim / preformatted and $\sqrt{x}$ is not knitted.

Inline Equations

This equation $\bar{X} = \frac{1}{n} \sum X_i$ appears inline.

This equation \(\bar{X} = \frac{1}{n} \sum X_i\) appears inline.

Note: in the .Rmd file you will see one code block within a set of ``` (not knitted/evaluated) and one code block without the ``` (knitted/evaluated)

Display-mode Equations

This equation $$\bar{y} = \frac{1}{n} \sum y_i$$ appears in display mode (indented on its own line)

This equation \[\bar{y} = \frac{1}{n} \sum y_i\] appears in display mode (indented on its own line)