-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2.1_landings_comparison.Rmd
62 lines (51 loc) · 1.88 KB
/
2.1_landings_comparison.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
---
title: "Landings: comparison"
date: "`r Sys.Date()`"
output:
html_document:
toc: true
toc_depth: 3
toc_float:
collapsed: FALSE
code_folding: show
number_sections: TRUE
---
# SET-UP
```{r markdown, echo=F}
library(knitr)
opts_chunk$set(echo = T, collapse = T, fig.align = "center", fig.width = 9, fig.height = 6)
options(width = 140)
```
## settings
```{r settings, message = F}
source('0.0_settings.R')
```
## load all data
```{r data, message = F}
# New catch
load(paste0(dir.rdat, "catch.Rdata"))
# Old landings (both 2016 by Thomas and 2018 by Andrew)
repo <- "https://github.com/iml-assess/mackerel_assessment/blob/master/"
catch.Francois <- read.ices(url(paste0(repo,'data/2014/ct.dat',"?raw=true")))
catch.Thomas <- read.ices(url(paste0(repo,'data/2016/ct.dat',"?raw=true")))
catch.Andrew <- read.ices(url(paste0(repo,'data/2018/ct.dat',"?raw=true")))
```
## Binding
```{r wrangle, message = F}
catch.new <- ddply(catch,c('year'),summarise,catch=sum(catch,na.rm = T),source='New')
catch.Francois <- data.frame(year=as.numeric(row.names(catch.Francois)),
catch=catch.Francois[,1],
source='Francois (2014)')
catch.Thomas <- data.frame(year=as.numeric(row.names(catch.Thomas)),
catch=catch.Thomas[,1],
source='Thomas (2016)')
catch.Andrew <- data.frame(year=as.numeric(row.names(catch.Andrew)),
catch=catch.Andrew[,1],
source='Andrew (2018)')
catch.comp <- rbind(catch.new,catch.Francois,catch.Thomas,catch.Andrew)
catch.comp$source <- factor(catch.comp$source,levels=c('New','Andrew (2018)','Thomas (2016)','Francois (2014)'))
```
# PLOT
```{r catch_total_comparison, echo=F}
ggplot(catch.comp[!is.na(catch.comp$catch),],aes(x=year,y=catch,color=source))+geom_line(size=1)+scale_color_viridis_d()
```