forked from yihui/knitr-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
006-minimal.Rrst
39 lines (29 loc) · 921 Bytes
/
006-minimal.Rrst
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
A reST document for knitr
=========================
This is a reStructuredText document. The input filename extension is ``Rrst``
and the output filename will be ``rst``. Here is how we write R code in
**knitr**:
.. {r setup}
options(width = 75)
library(knitr)
# do not use the sourcecode directive
render_rst(strict=TRUE)
# global chunk options
opts_chunk$set(fig.width=5, fig.height=5)
.. ..
More examples
-------------
A code chunk begins with ``.. {r label, options}``, and ends with ``.. ..``
(note the space in between). Optionally you can precede all R code with two
dots, e.g.
.. {r rst-example}
.. 1+1
.. set.seed(123); rnorm(10)
.. warning('do not forget the space after ..!')
.. ..
Here is a plot:
.. {r rst-plot, out.width='360px', fig.cap='A ggplot2 example', message=FALSE}
library(ggplot2)
qplot(hp, mpg, data=mtcars) + geom_smooth()
.. ..
Inline R code is like this: the value of pi is :r:`pi`.