forked from ices-taf-dev/ices_cat_3_template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreport.R
69 lines (54 loc) · 2.17 KB
/
report.R
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
### ------------------------------------------------------------------------ ###
### Prepare plots and tables for report ####
### ------------------------------------------------------------------------ ###
## Before: model/advice.rds
## After: figures in report/figures/
## tables in report/tables
library(TAF)
library(cat3advice)
library(ggplot2)
mkdir("report")
mkdir("report/figures")
mkdir("report/tables")
### ------------------------------------------------------------------------ ###
### load advice ####
### ------------------------------------------------------------------------ ###
advice <- readRDS("model/advice.rds")
### ------------------------------------------------------------------------ ###
### rfb rule - figures ####
### ------------------------------------------------------------------------ ###
### A - reference catch
### no figures
### r - biomass index trend/ratio
plot(advice@r)
ggsave("report/figures/rfb_r.png", width = 10, height = 6, units = "cm",
dpi = 300, type = "cairo")
### b - biomass safeguard
plot(advice@b)
ggsave("report/figures/rfb_b.png", width = 10, height = 6, units = "cm",
dpi = 300, type = "cairo")
### b & r
plot(advice@r, advice@b)
ggsave("report/figures/rfb_rb.png", width = 10, height = 6, units = "cm",
dpi = 300, type = "cairo")
### f - length at first capture
plot(advice@f@Lmean@Lc)
ggsave("report/figures/rfb_Lc.png", width = 15, height = 10, units = "cm",
dpi = 300, type = "cairo")
### f - annual length distributions
plot(advice@f@Lmean)
ggsave("report/figures/rfb_Lmean.png", width = 15, height = 10, units = "cm",
dpi = 300, type = "cairo")
### f - length indicator
plot(advice@f)
ggsave("report/figures/rfb_f.png", width = 10, height = 6, units = "cm",
dpi = 300, type = "cairo")
### ------------------------------------------------------------------------ ###
### rfb rule - advice table ####
### ------------------------------------------------------------------------ ###
### create ICES advice style table
### numbers are rounded following ICES rounding rules
### print to screen
advice(advice)
### save in file
capture.output(advice(advice), file = "report/tables/advice_table.txt")