Debian Codegraph @

vignettes/docco-linear.Rmd

raw
1 ---
2 title: R Markdown with the Docco Linear Style
3 ---
4
5 <!--
6 %\VignetteEngine{knitr::docco_linear_notangle}
7 %\VignetteIndexEntry{R Markdown with the Docco Linear Style}
8 -->
9
10 This is an example of Markdown vignettes using the [Docco style](http://ashkenas.com/docco/).
11
12 ## Docco
13
14 To use the Docco style for Markdown vignettes in an R package, you need to
15
16 - add `*.Rmd` files under the `vignettes` directory
17 - add `Suggests: knitr` and `VignetteBuilder: knitr` to the `DESCRIPTION` file
18 - specify the vignette engine `\VignetteEngine{knitr::docco_linear}` in the `Rmd` files (inside HTML comments)
19
20 After building and installing the package, you can view vignettes via
21
22 ```r
23 browseVignettes(package = 'Your_Package')
24 ```
25
26 ## Examples
27
28 Below are some code chunks as examples.
29
30 ```{r hello, results='asis'}
31 cat('_hello_ **markdown**!', '\n')
32 ```
33
34 Normally you do not need any chunk options.
35
36 ```{r}
37 1+1
38 10:1
39 rnorm(5)^2
40 strsplit('hello, markdown vignettes', '')
41 ```
42
43 Feel free to draw beautiful plots and write math $P(X>x)=\alpha/2$.
44
45 ```{r}
46 n=300; set.seed(123)
47 par(mar=c(4,4,.1,.1))
48 plot(rnorm(n), rnorm(n), pch=21, cex=5*runif(n), col='white', bg='gray')
49 ```
50
51 ## How does it work
52
53 Custom CSS and JS files are passed to `markdown::mark_html()` to style the HTML page:
54
55 ```r
56 knitr:::docco_linear
57 ```
58
59 That is it.