-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathreport.Rmd
More file actions
103 lines (74 loc) · 2.35 KB
/
report.Rmd
File metadata and controls
103 lines (74 loc) · 2.35 KB
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
---
output:
word_document:
fig_caption: true
fig_height: 10
fig_width: 10
reference_docx: boot/data/reportTemplate.docx
toc: true
keep_md: false
html_document: default
bibliography: boot/DATA.bib
nocite: '@*'
---
```{r libraries, include=FALSE}
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, lets choose 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 to get the numbering correct
table_nums("catch_table", "Estimated catch at age.")
# set figure captions in the order they appear in the report to get the numbering correct
figure_nums("retro_plot", "Retrospective of SSB, F and Recruitment (age 0).")
figure_nums("fbar_plot", "Plot of F bar (3-5) from the final assessment run.")
```
# Example Stock report
## Example stock in ICES Division 4
### Catch data
```{r catch_table}
catch_table <- read.taf("report/catage.csv")
# set caption
set.caption(table_nums("catch_table"))
# Output table
pander(style_table1(catch_table), missing = "-")
```
### Retrospective
```{r mohns}
mohns <- read.taf("output/mohns_rho.csv")
```
The mohns rho value for F is `r round(mohns[1,"Fbar(3-7)"], 3)`. The
plot of the retrospective is plotted in `r figure_nums("retro_plot", display = "cite")`
```{r retro_plot, fig.cap = cap_in}
# Figure Caption
cap_in <- figure_nums("retro_plot")
# Output figure
include_graphics("report/retrospective.png")
```
### F at age estimate
```{r catch_plot, fig.cap = cap_in}
# Figure Caption
cap_in <- figure_nums("fbar_plot")
# Output figure
include_graphics("report/Fbar.png")
```
# References
<div id="refs"></div>