11.4 Text Formating in R Markdown

The text in an R Markdown file is written with Markdown syntax. Markdown is a lightweight markup language that creates styled text using a lightweight plain text syntax. For example, we can use asterisks to generate italic text and double asterisks to generate bold text.

*italic text*
**bold text**

We can mark text as inline code by writing it between a pair of backticks.

`x+y`

To start a new pararaph, we can end a line with two or more spaces. We can also write section headers using pound signs (#, ## and ### for first, second and third level headers, respectively).

# First-level header
## Second-level header
### Third-level header
  • Lists with unordered items can be written with -, *, or +, and lists with ordered list items can be written with numbers. Lists can be nested by indenting the sublists.
- unordered item
- unordered item
    1. first item
    2. second item
    3. third item

We can also write math formulas using LaTex syntax.

$$\int_0^\infty e^{-x^2} dx=\frac{\sqrt{\pi}}{2}$$

\[\int_0^\infty e^{-x^2} dx=\frac{\sqrt{\pi}}{2}\]

Hyperlinks can be added using the syntax text. For example, a hyperlink to the R Markdown website can be created as follows:

[R Markdown](https://rmarkdown.rstudio.com/)

R Markdown