1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 # A Minimal Example for MarkdownThis is a minimal example of using **knitr** to produce an _HTML_ page from _Markdown_.## R code chunks{r setup}# set global chunk options: images will be 7x5 inchesopts_chunk$set(fig.width=7, fig.height=5)Now we write some code chunks in this markdown file:{r computing}x <- 1+1 # a simple calculatorset.seed(123)rnorm(5) # boring random numbersWe can also produce plots:{r graphics}par(mar = c(4, 4, .1, .1))with(mtcars, { plot(mpg~hp, pch=20, col='darkgray') lines(lowess(hp, mpg))})## Inline codeInline R code is also supported, e.g. the value of x is r x, and 2 × π= r 2*pi.## MathLaTeX math as usual:$f(\alpha, \beta) \propto x^{\alpha-1}(1-x)^{\beta-1}\$.## MiscYou can indent code chunks so they can nest within other environments such as lists.1. the area of a circle with radius x    {r foo}    pi * x^2    2. OK, that is greatTo compile me, use{r compile, eval=FALSE}library(knitr)knit('knitr-minimal.Rmd')## ConclusionMarkdown is super easy to write. Go to **knitr** [homepage](http://yihui.name/knitr) for details.