-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
81 lines (61 loc) · 2.6 KB
/
README.Rmd
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
---
title: AmaRYAML – Amarakon’s YAML
output: amaryaml::github
---
```{r setup, include = FALSE}
library(knitr)
opts_chunk$set(echo = FALSE, cache = TRUE)
```
# Description
R package which includes a suite of custom R Markdown templates.
Most of these templates use LaTeX, GitHub is the exception.
These templates are useful due to them having common information in the YAML header.
They also include global R options that are helpful.
I use them so I don't have to define them each time I create a new R Markdown file.
# Templates
There are currently four templates available in this package:
```{r templates}
one = c("![Book](examples/book/book.png)")
two = c("![Eisvogel](examples/eisvogel/eisvogel.png)")
templates = data.frame(one, two)
kable(templates, 'pipe', align = 'cc', col.name = c("[Book](examples/book/book.pdf)", "[Eisvogel](examples/eisvogel/eisvogel.pdf)"))
```
```{r templates}
one = c("![GitHub](examples/github/github.png)")
two = c("![NorBeam](examples/norbeam/norbeam.png)")
templates = data.frame(one, two)
kable(templates, align = 'cc', col.name = c("[GitHub](examples/github/github.md)", "[NorBeam](examples/norbeam/norbeam.pdf)"))
```
```{r templates}
one = c("![Leaflet [1/2]](examples/leaflet/leaflet-1.png)")
two = c("![Leaflet [2/2]](examples/leaflet/leaflet-2.png)")
templates = data.frame(one, two)
kable(templates, align = 'cc', col.name = c("[Leaflet [1/2]](examples/leaflet/leaflet.pdf)", "[Leaflet [2/2]](examples/leaflet/leaflet.pdf)"))
```
## GitHub
The GitHub template uses a pandoc lua filter script named `lower-header.lua`.
This simple script only occupies four lines of code.
Its purpose is to make each section header one level lower.
For example: level one headers (`#`) will be turned to level two headers (`##`), and so on.
# Installation
The *amaryaml* package is currently only available from GitHub.
You need the *remotes* package to install from GitHub:
```r
install.packages("remotes")
remotes::install_github("Amarakon55/amaryaml")
```
This package requires LaTeX for most templates.
The [*tinytex* package](https://github.com/yihui/tinytex) makes it easy to setup LaTeX within R:
```r
install.packages("tinytex")
tinytex::install_tinytex()
```
# Usage
Using *AmaRYAML* is very easy.
There are two main ways to do so:
1. selecting a template in RStudio using the R Markdown template selector
1. creating a new draft with the `rmarkdown::draft()` function
- `rmarkdown::draft("file.Rmd", "book", "amaryaml")`
- `rmarkdown::draft("file.Rmd", "eisvogel", "amaryaml")`
- `rmarkdown::draft("file.Rmd", "github", "amaryaml")`
- `rmarkdown::draft("file.Rmd", "norbeam", "amaryaml")`