Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
40 lines (29 sloc) 921 Bytes
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
.. {r setup}
options(width = 75)
# do not use the sourcecode directive
# 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}
qplot(hp, mpg, data=mtcars) + geom_smooth()
.. ..
Inline R code is like this: the value of pi is :r:`pi`.