-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreport.Rmd
84 lines (63 loc) · 2.32 KB
/
report.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
82
83
84
---
output:
word_document:
fig_caption: true
fig_height: 10
fig_width: 10
reference_docx: bootstrap/data/reportTemplate.docx
toc: true
keep_md: false
---
```{r libraries, include=FALSE}
taf.library(captioner)
library(knitr)
library(pander)
```
```{r chunk_setup, include=FALSE}
# CHUNK SETUPS #################################################################
knitr::opts_chunk$set(echo = FALSE, warning = FALSE,
message=FALSE, results = 'asis')
```
```{r pander_settings, include = FALSE}
# PANDER OPTIONS ##############################################################
panderOptions('table.split.table', Inf)
panderOptions('keep.trailing.zeros', TRUE)
panderOptions('table.alignment.default', "center")
```
```{r caption_counters, include=FALSE}
table_nums <- captioner("Table", level = 3)
figure_nums <- captioner("Figure", level = 3)
# set levels, sandeel 6 is section 9.6
tab_env <- environment(table_nums)
fig_env <- environment(figure_nums)
tab_env$OBJECTS$number[[1]] <- list(9, 6, 1)
fig_env$OBJECTS$number[[1]] <- list(9, 6, 1)
# set table captions in the order they appear in the report
table_nums("catch_table", "Sandeel. Total catch (tonnes) for the first and second half of the year as estimated by ICES")
# set figure captions in the order they appear in the report
figure_nums("catch_plot", "Sandeel. Total catch (tonnes) by year as estimated by ICES.")
figure_nums("catch_plot2", "Sandeel. Total catch (tonnes) by year for the first and second half of the year as estimated by ICES.")
```
# Sandeel in Division 3.a and Subarea 4
## Sandeel in SA 6
### Catch data
Total catch weight by year for SA 6 is given in `r table_nums("catch_table", display = "cite")`, and plotted in `r figure_nums("catch_plot", display = "cite")` and `r figure_nums("catch_plot2", display = "cite")`
```{r catch_table}
catch_table <- read.taf("report/summary_catch.csv")
# set caption
set.caption(table_nums("catch_table"))
# Output table
pander(style_table1(catch_table), missing = "-")
```
```{r catch_plot, fig.cap = cap_in}
# Figure Caption
cap_in <- figure_nums("catch_plot")
# Output figure
include_graphics("report/summary_catch.png")
```
```{r catch_plot2, fig.cap = cap_in}
# Figure Caption
cap_in <- figure_nums("catch_plot2")
# Output figure
include_graphics("report/catches_by_halfyear_bar.png")
```