/
template.qmd
104 lines (86 loc) · 1.72 KB
/
template.qmd
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
---
title: "TITLE"
subtitle: "SUBTITLE"
author: "AUTHOR"
date: "`r format(Sys.Date(), '%d %b %Y')`"
# universal output options
number-sections: true
number-offset: 0
toc: true
toc-depth: 2
fig-width: 6
fig-height: 4
df-print: tibble
embed-resources: true
# format specific output options
format:
# html file
html:
code-tools: true
code-fold: show
code-summary: "Show the code"
toc-float: true
# word file
docx:
toc-title: "Table of contents"
fig-dpi: 600
execute:
echo: false
# knitr global chunk options
knitr:
opts_chunk:
fig.path: "plots/"
fig.keep: "all"
dev: ['png', 'pdf']
dev.args:
pdf:
encoding: 'WinAnsi'
useDingbats: false
# bibliography and cross-references
bibliography: references.bib
crossref:
fig-prefix: Fig.
tbl-prefix: Table
ref-hyperlink: true
# rstudio editor options
editor: source
editor_options:
chunk_output_type: console
---
# Setup
Using `r R.version.string` , @R, and tidyverse version `r packageVersion("tidyverse")`, @tidyverse.
```{r}
#| label: setup
#| message: false
# load packages
library(tidyverse)
# load scripts
```
# Data
```{r}
# load data
```
# Plots {#sec-plots}
@fig-example in section @sec-plots is a work of art.
## Heading 2
### Heading 3
```{r}
#| label: fig-example
#| fig-cap: Miles per gallon in city vs. highway driving for different car types.
#| fig-width: 5
#| fig-height: 3
ggplot(mpg) +
aes(x = hwy, y = cty, color = class) +
geom_point()
```
# Tables
My @tbl-example is even more amazing.
```{r}
#| label: tbl-example
#| tbl-cap: This is my happy table, even has a beautiful equation $x^2 - \alpha$
#| tbl-cap-location: top
knitr::kable(head(mpg))
```
# References
::: {#refs}
:::