0.1 Plain text

In this document, we will start to learn the basic syntax to use R markdown to write document. Within a R markdown file, we could have descriptive text, math equations, code chunk, and other settings. R markdown also ignore multiple spaces, like this, would just get one space. If you really want to add extra space within your text, use non breaking space tag:      , then you got extra three space. Want a new line, but fail even though with a carriage return.

Start a new line with two blank spaces. Within R markdown, trying two blank spaces works like rebooting your machine when something does not work.

0.2 Heading

1 level-1

1.1 level-2

1.1.1 level-3

1.1.1.1 level-4

1.1.1.1.1 level-…

1.2 Basic format

italics and bold or italics and bold.

strikethrough

superscript2

subscript3

There is no defined underline syntax in R markdown. But R markdown also takes HTML tags, so we could use underline for underline.

We also could use them together, e.g. underline and bold, italics and bold, underline and bold and italics

A footnote 1

1.3 List

Have an unordered list first:

  • unordered list
  • another one
    • sub-item (indented)
    • sub-item
      • sub-sub-item
      • sub-sub-item
  • item-3
  • item-4

Have an ordered list then:

  1. ordered list
  2. another item
    • sub-unordered item
    • sub-unordered item
      1. sub-sub-ordered item
      2. sub-sub-ordered item
  3. item-3
  4. item-4 (even though I type 1, it still show 4 in the text)

Sometimes, two blank spaces are necessary between two items when using some template.

1.4 Insert

1.4.1 Code

R code chunk:

x <- 2
print(x)
## [1] 2

It is better to name your code chunk. Two chunks cannot have the same name. And specify chunk options based on your need.

Inline code with evaluation 12 .

Inline code just for display sum.

1.4.2 Image

Insert an image using

or we could use code chunk to insert:

1.4.4 Math equation

Inline equation: \(A = \pi*r^{2}\)

Equation chunk: \[A = \pi*r^{2}\]

1.5 Blockquote

1.5.1 One block

blockquote here

1.5.2 Block with multiple paragraphs

blockquote paragraph1

blockquote paragraph2

1.5.3 Nested block

blockquote

Nested blockquote

1.5.4 A formatted block

inside of blockquote, other also works

  • quote 1
  • quote 2

Nested blockquote


  1. here is footnote 1.↩︎