A minimal R Markdown example

A quote:

Markdown is not LaTeX.

To compile me, run this in R:


See output here.

code chunks

A paragraph here. A code chunk below (remember the three backticks):

1 + 1
## [1] 2
0.4 - 0.7 + 0.3  # what? it is not zero!
## [1] 5.551e-17


It is easy. I did not really show the plot here; if you want it, remove the option eval=FALSE from the chunk header below.


inline code

Yes I know the value of pi is 3.1416, and 2 times pi is 6.2832.


Sigh. You cannot live without math equations. OK, here we go: \( \alpha+\beta=\gamma \). Note this is not supported by native markdown. You probably want to try RStudio, or at least the R package markdown, or the function knitr::knit2html().

nested code chunks

You can write code within other elements, e.g. a list

  1. foo is good {r} strsplit('hello indented world', ' ')[[1]]
  2. bar is better


Nothing fancy. You are ready to go. When you become picky, go to the knitr website.

knitr logo