-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEastCoast_re-Opening.qmd
1930 lines (1611 loc) · 77.9 KB
/
EastCoast_re-Opening.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
title: "Re-opening a closed abalone fishery: East Coast case study"
author:
- name: Jaime McAllister
affiliations:
- name: IMAS, University of Tasmania
department: IMAS-FA
date: last-modified
date-format: "[Last Updated on] DD MMMM, YYYY"
format:
docx:
highlight-style: github
papersize: A4
code-overflow: "wrap"
reference-doc: word-styles-reference-01.docx
toc: true
number-sections: false
toc-depth: 4
number-depth: 4
margin-left: 0.75in
margin-right: 0.75in
margin-top: 1in
margin-bottom: 1in
pdf:
documentclass: scrreport
keep-tex: true
dpi: 600
pdf-engine: lualatex
toc: true
toc-depth: 4
toc_float: true
number-sections: false
number-depth: 4
highlight-style: github
papersize: "A4paper"
linestretch: 1.25
mainfont: Calibri
geometry:
- left = 20mm
- right = 20mm
- top = 20mm
- bottom = 10mm
editor:
markdown:
wrap: 72
---
```{r setup}
#| echo: false
#| warning: false
#| message: false
##---------------------------------------------------------------------------##
# clear console
rm(list = ls())
## 1. Load libraries ####
suppressPackageStartupMessages({
library(dplyr)
library(ggplot2)
library(scales)
library(tidyr)
library(gdata)
library(openxlsx)
library(lubridate)
library(reshape)
library(gridExtra)
library(ggpubr)
library(readxl)
library(tibble)
library(data.table)
#library(janitor)
#library(anytime)
library(stringr)
library(broom)
library(purrr)
library(sf)
library(ggspatial)
library(tmap)
library(sf)
library(sp)
library(RColorBrewer)
library(viridis)
library(ggpmisc)
#library(arsenal)
#library(fuzzyjoin)
#library(tidytext)
})
source("C:/GitCode/AbResearch/getLegend.r")
source("C:/GitCode/AbResearch/StandardError_Functions.r")
# Colour palette for plots
col_light <- c('#77AADD', '#99DDFF', '#44BB99', '#BBCC33',
'#AAAA00', '#EEDD88', '#EE8866', '#FFAABB',
'#DDDDDD')
```
# Background
The Eastern Zone abalone fishery has experienced significant catch declines and fluctuating catch rates since the 1990s, and in 2020 five abalone fishing blocks (16, 22, 23, 24 and 27) and sub-block 28A were closed to commercial fishing. As part of the closure, it was agreed that these blocks would be surveyed by IMAS under a no-take plan, with assistance from industry on site selection and field work, to determine the geographic extent of depletion and monitor the temporal recovery in stocks.
Since 2020 a fishery independent timed swim survey has been conducted by IMAS enabling rapid assay of stock status across the broad spatial extent of the east coast closure. In summary, the timed swim survey method involves paired divers conducting a 10-minute timed swim on SSBA, counting and measuring all emergent abalone on a measuring slate, at up to 60 sites in each closed block, derived from historical abalone fishery diver GPS logger data (2012-2019). Measured abalone are classified as legal (>140 mm) or sub-legal (<140 mm) and temporal changes in their abundance compared with baseline abundance determined in 2020.
An assessment of trends in abundance since 2020 has been used to evaluate the effectiveness of recovery efforts and to determine when it is appropriate to re-open the fishery. The criteria for reopening the closed blocks are based on several key performance indicators from the timed swim surveys. Key criteria include:
1. Increasing sub-legal and legal counts relative to the 2020 baseline.
2. Evidence of a widespread trend of increasing sub-legal and legal counts across the Block.
3. Evidence of multiple size classes particularly above the size limit.
This report outlines findings from timed swim surveys conducted by IMAS in 2024 and are assessed in regard to meeting the criteria for re-opening.
```{r}
#| echo: false
#| warning: false
#| message: false
# Identify sampling year of interest
samp_year <- 2024
# Identify input and output folders
samp_year_folder <- file.path(paste(sprintf('C:/Users/%s/Dropbox (UTAS Research)/DiveFisheries/Abalone/FISdata',
Sys.info()[["user"]])), paste('FIS_TimedSwimSurveys', samp_year, sep = ''))
ts_plots_folder <- file.path(paste(sprintf('C:/Users/%s/Dropbox (UTAS Research)/DiveFisheries/Abalone/Assessment/Figures/FIS',
Sys.info()[["user"]])), paste('FIS_TimedSwimSurveys', samp_year, '_Plots', sep = ''))
# Import final dataframes
time_swim_dat_final <-
readRDS(paste(samp_year_folder, '/time_swim_dat_final.RDS', sep = ''))
time_swim_dat_df_final <-
readRDS(paste(samp_year_folder, '/time_swim_dat_df_final.RDS', sep = ''))
# Import metadata frame
time_swim_meta_dat_final <- readRDS(paste(samp_year_folder, '/time_swim_meta_dat_final.RDS', sep = ''))
# Site filter for AVG sample collection in Block 28 on 2024-08-11
time_swim_dat_final <- time_swim_dat_final %>%
filter(sampdate != as.Date('2024-08-11') & site != 'AB-21-28-36',
!site %in% c('DP1', 'DP2', 'DP3'))
time_swim_dat_df_final <- time_swim_dat_df_final %>%
filter(sampdate != as.Date('2024-08-11') & site != 'AB-21-28-36',
!site %in% c('DP1', 'DP2', 'DP3'))
```
```{r}
#| echo: false
#| warning: false
#| message: false
# Summarise total count for blockno x site x sampyear x legal_size
ts_count_sum <- time_swim_dat_final %>%
filter(!subblockno %in% c('28B', '28C')) %>%
group_by(blockno, site, sampyear, legal_size) %>%
summarise(ab_n = sum(sizeclass_freq_10)) %>%
group_by(blockno, site, sampyear, legal_size) %>%
group_by(site)
ts_av_count <- time_swim_dat_final %>%
filter(!subblockno %in% c('28B', '28C')) %>%
group_by(blockno, site, diver, sampyear, legal_size) %>%
summarise(ab_n = sum(sizeclass_freq_10)) %>%
group_by(blockno, sampyear, legal_size) %>%
summarise(av_count = mean(ab_n),
sites = n_distinct(site)) %>%
pivot_wider(id_cols = c(blockno),
names_from = c(legal_size, sampyear),
values_from = c('av_count', 'sites'))
ts_block_mean <- time_swim_dat_final %>%
filter(!subblockno %in% c('28B', '28C')) %>%
group_by(blockno, site, diver, sampyear, legal_size) %>%
summarise(ab_n = sum(sizeclass_freq_10)) %>%
group_by(blockno, sampyear, legal_size) %>%
summarise(av_count = mean(ab_n),
sites = n_distinct(site))
# Determine mean abalone abundance for block x sampyear x size class
ten_min_mean_year <- time_swim_dat_final %>%
filter(!subblockno %in% c('28B', '28C') &
!blockno %in% c('13', '14', '29', '30') &
!is.na(sizeclass_freq_10)) %>%
group_by(blockno, site, diver, sampyear, time_elapsed, legal_size) %>%
summarise(ab_n = sum(sizeclass_freq_10)) %>%
group_by(blockno, sampyear, legal_size) %>%
summarise(mean_ab_n = mean(ab_n),
median_ab_n = median(ab_n))
# Determine percentage change in abundance between current and previous year
perc_change <- ten_min_mean_year %>%
select(-median_ab_n) %>%
spread(sampyear, mean_ab_n) %>%
dplyr::rename(FY2020 = '2020',
FY2021 = '2021',
FY2022 = '2022',
FY2023 = '2023',
FY2024 = '2024') %>%
mutate(perc_change = round((1 - (FY2023 / FY2024)), 3) * 100) %>%
spread(legal_size, perc_change) %>%
select(-c('FY2020', 'FY2021', 'FY2022', 'FY2023', 'FY2024')) %>%
mutate(`>140 mm2` = ifelse(is.na(`>140 mm`), lag(`>140 mm`), `>140 mm`)) %>%
select(-`>140 mm`) %>%
filter(!is.na(`<140 mm`)) %>%
dplyr::rename(`>140 mm` = `>140 mm2`, 'BlockNo' = 'blockno')
# Determine number of sites surveyed in sample year
sites_year <- time_swim_dat_final %>%
filter(!subblockno %in% c('28B', '28C') &
!blockno %in% c('13', '14', '29', '30') &
!is.na(sizeclass_freq_10) &
sampyear == samp_year) %>%
group_by(blockno) %>%
summarise(Sites = n_distinct(site))
# Join percentage changes and number of sites surveyed dataframes
year_tab <- left_join(sites_year, perc_change, by = c('blockno' = 'BlockNo')) %>%
dplyr::rename('BlockNo' = 'blockno')
```
\newpage
```{r}
#| label: tbl-year-tab1-flex
#| tbl-cap: "Site Percenatge Change: Summary table of sites surveyed in sample year and percentage change in abundance of legal and sub-legal abalone between sample year (2024) and previous year (2023)."
#| echo: false
#| warning: false
#| message: false
#| fig-pos: "H"
## Create flextable table
flex_year_tab <- year_tab %>%
flextable::flextable()
flex_year_tab
## Export flextable to docx file if required
flex_year_tab %>%
flextable::save_as_docx(path = file.path(ts_plots_folder, paste('TimedSwimSurvey_', samp_year-1, 'vs', samp_year, '_PercentChangeTable.docx')))
year_tab %>%
write.xlsx(file = paste(ts_plots_folder, paste('/TimedSwimSurvey_', samp_year-1, 'vs', samp_year, '_PercentChange.xlsx', sep = ''), sep = ''), sheetName = "Sheet1", col.names = TRUE, row.names = TRUE, append = FALSE)
```
```{r}
#| label: tbl-year-tab2
#| tbl-cap: "Reference Site Percenatge Change: Summary table of sites surveyed in sample year and percentage change in abundance of legal and sub-legal abalone between sample year (2024) and previous year (2023)."
#| echo: false
#| warning: false
#| message: false
#| fig-pos: "H"
# Determine mean abalone abundance for block x sampyear x size class
ten_min_mean_year <- time_swim_dat_final %>%
filter(!subblockno %in% c('28B', '28C') &
!blockno %in% c('13', '14', '21', '29', '30') &
!is.na(sizeclass_freq_10) &
ref_site == 1) %>%
group_by(blockno, site, diver, sampyear, time_elapsed, legal_size) %>%
summarise(ab_n = sum(sizeclass_freq_10)) %>%
group_by(blockno, sampyear, legal_size) %>%
summarise(mean_ab_n = mean(ab_n),
median_ab_n = median(ab_n))
# Determine percentage change in abundance between current and previous year
perc_change <- ten_min_mean_year %>%
select(-mean_ab_n) %>%
spread(sampyear, median_ab_n) %>%
dplyr::rename(FY2020 = '2020',
FY2021 = '2021',
FY2022 = '2022',
FY2023 = '2023',
FY2024 = '2024') %>%
mutate(perc_change = round((1 - (FY2023 / FY2024)), 3) * 100) %>%
spread(legal_size, perc_change) %>%
select(-c('FY2020', 'FY2021', 'FY2022', 'FY2023', 'FY2024')) %>%
mutate(`>140 mm2` = ifelse(is.na(`>140 mm`), lag(`>140 mm`), `>140 mm`)) %>%
select(-`>140 mm`) %>%
filter(!is.na(`<140 mm`)) %>%
dplyr::rename(`>140 mm` = `>140 mm2`,
'BlockNo' = 'blockno')
# Determine number of sites surveyed in sample year
sites_year <- time_swim_dat_final %>%
filter(!subblockno %in% c('28B', '28C') &
!blockno %in% c('13', '14', '29', '30') &
!is.na(sizeclass_freq_10) &
sampyear == samp_year &
ref_site == 1) %>%
group_by(blockno) %>%
summarise(Sites = n_distinct(site))
# Join percentage changes and number of sites surveyed dataframes
year_tab <- left_join(sites_year, perc_change, by = c('blockno' = 'BlockNo')) %>%
dplyr::rename('BlockNo' = 'blockno')
## Create flextable table
flex_year_tab <- year_tab %>%
flextable::flextable()
flex_year_tab
## Export table
flex_year_tab %>%
flextable::save_as_docx(path = file.path(ts_plots_folder, paste('TimedSwimSurvey_', samp_year-1, 'vs', samp_year, '_PercentChange_ReferenceSites_Table.docx')))
year_tab %>%
write.xlsx(file = paste(ts_plots_folder, paste('/TimedSwimSurvey_', samp_year-1, 'vs', samp_year, '_PercentChange_ReferenceSites.xlsx', sep = ''), sep = ''), sheetName = "Sheet1", col.names = TRUE, row.names = TRUE, append = FALSE)
```
```{r}
#| label: tbl-year-tab3
#| tbl-cap: "Site abundance: Summary of sites surveyed and average count by Block. Sites = number of sites surveyed; Average count = average number of abalone <140 mm or >140 mm sounted within 10 minutes between paired divers at each site within a block."
#| echo: false
#| warning: false
#| message: false
#| fig-pos: "H"
# Create summary table
time_swim_count_blockno <- time_swim_dat_final %>%
filter(!subblockno %in% c('28B', '28C'),
sampyear == samp_year &
!blockno %in% c('13', '14', '29', '30')) %>%
group_by(blockno, site, diver, sampyear, legal_size, time_elapsed) %>%
summarise(ab_n = sum(sizeclass_freq)) %>%
group_by(blockno, legal_size) %>%
summarise(sites = n_distinct(site),
ab_min = round(mean(ab_n), digits = 1)) %>%
spread(legal_size, ab_min) %>%
as.data.frame() %>%
dplyr::rename('Blockno' = blockno,
'Sites' = sites,
'Average\ncount\n<140mm' = '<140 mm',
'Average\ncount\n>140mm' = '>140 mm')
## Create flextable table
flex_block_swim_count <- time_swim_count_blockno %>%
flextable::flextable()
flex_block_swim_count
## Export table
flex_year_tab %>%
flextable::save_as_docx(path = file.path(ts_plots_folder, paste('TimedSwimSurvey_', samp_year-1, 'vs', samp_year, '_SiteAverageAbundance_Table.docx')))
year_tab %>%
write.xlsx(file = paste(ts_plots_folder, paste('/TimedSwimSurvey_', samp_year-1, 'vs', samp_year, '_SiteAverageAbundance_Table.xlsx', sep = ''), sep = ''), sheetName = "Sheet1", col.names = TRUE, row.names = TRUE, append = FALSE)
```
```{r}
#| label: tbl-year-tab4
#| tbl-cap: "Summary of sites surveyed by Block in 2024. Sites = number of sites surveyed; Days = number of sampling days; Sites_Day = average number of sites surveyed for each sampling day. "
#| echo: false
#| warning: false
#| message: false
#| fig-pos: "H"
# Create summary table
ts_tab <- time_swim_dat_final %>%
filter(!subblockno %in% c('28B', '28C'),
sampyear == samp_year &
!blockno %in% c('13', '14', '29', '30')) %>%
group_by(sampyear, blockno) %>%
summarise(sites = n_distinct(site),
field_days = n_distinct(sampdate),
site_day = round(sites / field_days, digits = 1)) %>%
as.data.frame() %>%
dplyr::rename('Blockno' = blockno,
'Sites' = sites,
'Days' = field_days,
'Sites_Day' = site_day) %>%
add_row(Blockno = 'Total', Sites = sum(.$Sites), Days = sum(.$Days),
Sites_Day = round(mean(.$Sites_Day), digits = 1)) %>%
select(-sampyear)
## Create flextable table
flex_sites_surveyed <- ts_tab %>%
flextable::flextable()
flex_sites_surveyed
## Export table
flex_sites_surveyed %>%
flextable::save_as_docx(path = file.path(ts_plots_folder, paste('TimedSwimSurvey_', samp_year-1, 'vs', samp_year, '_SitesSurveyed_Table.docx')))
ts_tab %>%
write.xlsx(file = paste(ts_plots_folder, paste('/TimedSwimSurvey_', samp_year-1, 'vs', samp_year, '_SitesSurveyed_Table.xlsx', sep = ''), sep = ''), sheetName = "Sheet1", col.names = TRUE, row.names = TRUE, append = FALSE)
```
```{r}
#| echo: false
#| warning: false
#| message: false
##---------------------------------------------------------------------------##
## PLOT 1: Abundance Boxplot ####
# Average count of all legal and sub-legal abalone per 10 min by year for each
# site within each block (i.e. the average count between paired divers for each site).
# Determine mean abalone abundance in each block, year and size class
ten_min_mean_year <- time_swim_dat_final %>%
filter(!subblockno %in% c('28B', '28C') &
!blockno %in% c('13', '14', '21', '29', '30') &
!is.na(sizeclass_freq_10) &
sampyear <= samp_year) %>%
group_by(blockno, site, diver, sampyear, time_elapsed, legal_size) %>%
summarise(ab_n = sum(sizeclass_freq_10)) %>%
group_by(blockno, sampyear, legal_size) %>%
summarise(mean_ab_n = mean(ab_n),
median_ab_n = median(ab_n))
# mutate(sampyear = factor(sampyear))
# Determine number of sites surveyed in each block, year and size class
time_swim_dat_n <- time_swim_dat_final %>%
filter(!subblockno %in% c('28B', '28C') &
!blockno %in% c('13', '14', '21', '29', '30') &
sampyear <= samp_year) %>%
group_by(sampyear, blockno, legal_size) %>%
summarise(n = n_distinct(site))
# Plot for sub-legal abundance
sub_legal_plot <- time_swim_dat_final %>%
filter(!subblockno %in% c('28B', '28C'),
legal_size == '<140 mm' &
!blockno %in% c('13', '14', '21', '29', '30') &
sampyear <= samp_year) %>%
# filter(midsize < 150) %>%
group_by(blockno, site, diver, sampyear) %>%
summarise(ab_n = sum(sizeclass_freq_10)) %>%
group_by(blockno, site, sampyear) %>%
summarise(mean_ab_n = mean(ab_n)) %>%
mutate(sampyear = factor(sampyear, levels = c('2020', '2021', '2022', '2023', '2024'))) %>%
ggplot(aes(x = blockno, y = mean_ab_n)) +
geom_boxplot(aes(fill = sampyear), position = position_dodge2(1, preserve = 'single'),
outlier.colour = '#EE8866') +
scale_fill_manual(values = c("#77AADD", "#BBCC33", "#DDDDDD", '#44BB99', '#EE8866')) +
geom_point(data = ten_min_mean_year %>% filter(legal_size == '<140 mm'), aes(group = factor(sampyear, levels = c('2020', '2021', '2022', '2023', '2024'))), shape = 19,
size = 2, colour = 'red', fill = 'red', position = position_dodge2(0.8, preserve = 'single'))+
theme_bw() +
ylab(bquote('Average count (abalone.10'*~min^-1*')')) +
xlab('Blockno') +
coord_cartesian(ylim = c(0, 150)) +
geom_text(data = time_swim_dat_n %>% filter(legal_size == '<140 mm'), aes(y = 150, label = n, colour = factor(sampyear, levels = c('2020', '2021', '2022', '2023', '2024'))), size = 3,
position = position_dodge2(0.8)) +
scale_colour_manual(values = c("#77AADD", "#BBCC33", "#DDDDDD", '#44BB99', '#EE8866')) +
guides(size = 'legend', colour = 'none',
fill = guide_legend(title = 'Year'))+
ggtitle('Sub-legal <140 mm') +
theme(plot.title = element_text(vjust = 0, hjust = 0)) +
theme(legend.position = 'none')
# Plot for legal abundance
legal_plot <- time_swim_dat_final %>%
filter(!subblockno %in% c('28B', '28C'),
legal_size == '>140 mm' &
!blockno %in% c('13', '14', '21', '29', '30') &
sampyear <= samp_year) %>%
# filter(midsize < 150) %>%
group_by(blockno, site, diver, sampyear) %>%
summarise(ab_n = sum(sizeclass_freq_10)) %>%
group_by(blockno, site, sampyear) %>%
summarise(mean_ab_n = mean(ab_n)) %>%
mutate(sampyear = factor(sampyear, levels = c('2020', '2021', '2022', '2023', '2024'))) %>%
ggplot(aes(x = blockno, y = mean_ab_n))+
geom_boxplot(aes(fill = sampyear), position = position_dodge2(1, preserve = 'single'),
outlier.colour = '#EE8866') +
scale_fill_manual(values = c("#77AADD", "#BBCC33", "#DDDDDD", '#44BB99', '#EE8866'))+
geom_point(data = ten_min_mean_year %>% filter(legal_size == '>140 mm'), aes(group = factor(sampyear, levels = c('2020', '2021', '2022', '2023', '2024'))), shape = 19,
size = 2, colour = 'red', fill = 'red', position = position_dodge2(0.8, preserve = 'single'))+
theme_bw()+
ylab(bquote('Average count (abalone.10'*~min^-1*')'))+
xlab('Blockno')+
coord_cartesian(ylim = c(0, 150))+
guides(size = 'legend', colour = 'none',
fill = guide_legend(title = 'Year'))+
ggtitle('Legal >140 mm')+
theme(plot.title = element_text(vjust = 0, hjust = 0))+
theme(legend.title = element_blank(),
legend.position = c(0.9, 0.7))
```
```{r}
#| label: fig-Count-site-block
#| fig-cap: "Boxplot comparing the of the number of sub-legal (<140 mm) and legal (>140 mm) abalone counted within 10 minutes between paired divers at each site within a block between years. Red circle indicates the overall average between paired divers for the corresponding size class within the block. Number of sites sampled given above each boxplot."
#| echo: false
#| warning: false
#| message: false
#| fig-height: 7
#| fig-width: 7
#| out-height: 90%
#| fig-pos: "H"
library(patchwork)
count_plots <- sub_legal_plot / legal_plot
count_plots
ggsave(filename = paste(ts_plots_folder, paste('/TimedSwimSurvey_', samp_year, '_TenMinuteCount_LegalSubLegal_Boxplot', '.pdf', sep = ''), sep = ''), plot = count_plots, units = 'mm', width = 190, height = 200)
ggsave(filename = paste(ts_plots_folder, paste('/TimedSwimSurvey_', samp_year, '_TenMinuteCount_LegalSubLegal_Boxplot', '.png', sep = ''), sep = ''), plot = count_plots, units = 'mm', width = 190, height = 200)
```
```{r}
#| label: fig-Count-site-lineplot
#| fig-cap: "Average count of all legal (>140 mm) and sub-legal (<140 mm) abalone within 10 minutes between paired divers at each site within each block by year."
#| echo: false
#| warning: false
#| message: false
#| fig-height: 7
#| fig-width: 7
#| out-height: 90%
#| fig-pos: "H"
##---------------------------------------------------------------------------##
## PLOT 2: Abundance Lineplot ####
act_dat <- time_swim_dat_final %>%
mutate(samp_period = ifelse(between(sampdate, as.Date('2021-01-01'), as.Date('2021-03-31'))|
between(sampdate, as.Date('2023-01-01'), as.Date('2023-03-31')), 'Pre',
ifelse(between(sampdate, as.Date('2023-04-01'), as.Date('2023-12-31')), 'Mid', 'Post')))
# Determine mean abalone abundance in each block, year and size class
ten_min_mean_year <- act_dat %>%
filter((!subblockno %in% c('28B', '28C') &
!blockno %in% c('13', '14', '21', '29', '30') &
!is.na(sizeclass_freq_10) &
sampyear <= samp_year) |
(sampyear == 2021 & blockno == '13') |
(sampyear == 2023 & blockno == '13' & samp_period == 'Mid')) %>%
group_by(blockno, site, diver, sampyear, time_elapsed, legal_size) %>%
summarise(ab_n = sum(sizeclass_freq_10)) %>%
group_by(blockno, sampyear, legal_size) %>%
summarise(mean_ab_n = mean(ab_n),
median_ab_n = median(ab_n),
std_err = sd(ab_n)/sqrt(n()))
# mutate(sampyear = factor(sampyear))
# Determine number of sites surveyed in each block, year and size class
time_swim_dat_n <- act_dat %>%
filter((!subblockno %in% c('28B', '28C') &
!blockno %in% c('13', '14', '21', '29', '30') &
!is.na(sizeclass_freq_10) &
sampyear <= samp_year) |
(sampyear == 2021 & blockno == '13') |
(sampyear == 2023 & blockno == '13' & samp_period == 'Mid')) %>%
group_by(sampyear, blockno, legal_size) %>%
summarise(n = n_distinct(site))
abundance_plot <- ten_min_mean_year %>%
filter(blockno != 13) %>%
ggplot(aes(x = sampyear, y = mean_ab_n, group = legal_size, colour = legal_size))+
geom_point(position = position_dodge(0.05))+
geom_line()+
geom_errorbar(aes(ymin = mean_ab_n - std_err, ymax = mean_ab_n + std_err), width = 0.2,
position = position_dodge(0.05))+
scale_colour_manual(values = c('red', 'blue'))+
theme_bw()+
ylab(bquote('Average count (abalone.10'*~min^-1*')'))+
xlab('Survey Year')+
ylim(0, 70)+
theme(legend.position = 'bottom',
legend.background = element_rect(fill = "white", colour = NA))+
guides(colour = guide_legend(title = "Size Class"))+
facet_wrap(. ~ blockno, ncol = 3)
abundance_plot
ggsave(filename = paste(ts_plots_folder, paste('/TimedSwimSurvey_', samp_year, '_TenMinuteCount_LegalSubLegal_MeanLinePlot', '.pdf', sep = ''), sep = ''), plot = abundance_plot, units = 'mm', width = 190, height = 200)
ggsave(filename = paste(ts_plots_folder, paste('/TimedSwimSurvey_', samp_year, '_TenMinuteCount_LegalSubLegal_MeanLinePlot', '.png', sep = ''), sep = ''), plot = abundance_plot, units = 'mm', width = 190, height = 200)
```
```{r}
#| label: fig-Count-site-lineplot-act
#| fig-cap: "Average count of all legal (>140 mm) and sub-legal (<140 mm) abalone within 10 minutes between paired divers at each site within each block by year. Note: Block 13 (Actaeons region) in 2023 only includes data collected ‘mid-season’ (~October 2023)."
#| echo: false
#| warning: false
#| message: false
#| fig-height: 7
#| fig-width: 7
#| out-height: 90%
#| fig-pos: "H"
# Add sampling periods for Actaeons data (i.e. pre, mid, post)
act_dat <- time_swim_dat_final %>%
mutate(samp_period = ifelse(between(sampdate, as.Date('2021-01-01'), as.Date('2021-03-31'))|
between(sampdate, as.Date('2023-01-01'), as.Date('2023-03-31')), 'Pre',
ifelse(between(sampdate, as.Date('2023-04-01'), as.Date('2023-12-31')), 'Mid', 'Post')))
# Determine mean abalone abundance in each block, year and size class
ten_min_mean_year <- act_dat %>%
filter((!subblockno %in% c('28B', '28C') &
!blockno %in% c('13', '14', '21', '29', '30') &
!is.na(sizeclass_freq_10) &
sampyear <= samp_year) |
(sampyear == 2021 & blockno == '13' & sampdate >= as.Date('2021-04-01')) |
(sampyear == 2023 & blockno == '13' & samp_period == 'Mid')) %>%
group_by(blockno, site, diver, sampyear, time_elapsed, legal_size) %>%
summarise(ab_n = sum(sizeclass_freq_10)) %>%
group_by(blockno, sampyear, legal_size) %>%
summarise(mean_ab_n = mean(ab_n),
median_ab_n = median(ab_n),
std_err = sd(ab_n)/sqrt(n()))
# mutate(sampyear = factor(sampyear))
# Create dataframe of NAs for years where no data were collected in Actaeons
block_no <- '13'
samp_years <- c(2020, 2022, 2024)
legal_sizes <- c('<140 mm', '>140 mm')
mean_ab_ns <- NA
act_na_dat <- expand.grid(blockno = block_no, sampyear = samp_years, legal_size = legal_sizes, mean_ab_n = mean_ab_ns)
# Create plot
abundance_plot <- ten_min_mean_year %>%
bind_rows(., act_na_dat) %>%
ggplot(aes(x = sampyear, y = mean_ab_n, group = legal_size, colour = legal_size))+
geom_point(position = position_dodge(0.05))+
geom_line()+
geom_errorbar(aes(ymin = mean_ab_n - std_err, ymax = mean_ab_n + std_err), width = 0.2,
position = position_dodge(0.05))+
scale_colour_manual(values = c('red', 'blue'))+
geom_hline(yintercept = (ten_min_mean_year %>% filter(blockno == '13' & legal_size == '<140 mm' & sampyear == 2023) %>% select(mean_ab_n) %>% pull()), colour = 'red', linetype = 'dotted', size = 0.5)+
# geom_hline(yintercept = (ten_min_mean_year %>% filter(blockno == '13' & legal_size == '>140 mm' & sampyear == 2023) %>% select(mean_ab_n) %>% pull()), colour = 'blue', linetype = 'dashed', size = 0.5)+
theme_bw()+
ylab(bquote('Average count (abalone.10'*~min^-1*')'))+
xlab('Survey Year')+
ylim(0, 70)+
theme(legend.position = 'bottom',
legend.background = element_rect(fill = "white", colour = NA))+
guides(colour = guide_legend(title = "Size Class"))+
facet_wrap(. ~ blockno, ncol = 3)
abundance_plot
ggsave(filename = paste(ts_plots_folder, paste('/TimedSwimSurvey_', samp_year, '_TenMinuteCount_LegalSubLegal_MeanLinePlot_Actaeons', '.pdf', sep = ''), sep = ''), plot = abundance_plot, units = 'mm', width = 190, height = 200)
ggsave(filename = paste(ts_plots_folder, paste('/TimedSwimSurvey_', samp_year, '_TenMinuteCount_LegalSubLegal_MeanLinePlot_Actaeons', '.png', sep = ''), sep = ''), plot = abundance_plot, units = 'mm', width = 190, height = 200)
```
```{r}
#| label: fig-count-sizeclass-lineplot
#| fig-cap: "Average count of each abalone size class within 10 minutes between paired divers at each site within each block by year."
#| echo: false
#| warning: false
#| message: false
#| fig-height: 7
#| fig-width: 7
#| out-height: 90%
#| fig-pos: "H"
# Arrange size classes in order
sizeclasses <- c("0-100", "100-120", "120-140", "140-160", "160-180", "180-200", "200-220")
# Colour palette
cbp2 <- c("#D55E00", "#000000", "#009E73", "#0072B2", "#999999", "#CC79A7", "#E69F00")
cbp2 <- c('#FF0000', '#FFA07A', '#F08080','#0000FF', '#4169E1', '#00BFFF', '#ADD8E6')
# Determine mean abalone abundance in each block, year and size class
ten_min_mean_year <- time_swim_dat_final %>%
mutate(sizeclass_2021 = factor(sizeclass_2021, levels = sizeclasses)) %>%
filter((!subblockno %in% c('28B', '28C') &
!blockno %in% c('13', '14', '21', '29', '30') &
!is.na(sizeclass_freq_10) &
sampyear <= samp_year)) %>%
group_by(blockno, site, diver, sampyear, time_elapsed, sizeclass_2021, legal_size) %>%
summarise(ab_n = sum(sizeclass_freq_10)) %>%
group_by(blockno, sampyear, sizeclass_2021, legal_size) %>%
summarise(mean_ab_n = mean(ab_n),
median_ab_n = median(ab_n),
std_err = sd(ab_n)/sqrt(n()))
abundance_plot_legal <- ten_min_mean_year %>%
filter(blockno != 13 & legal_size == '>140 mm') %>%
ggplot(aes(x = sampyear, y = mean_ab_n, group = sizeclass_2021, colour = sizeclass_2021))+
# geom_point(position = position_dodge(0.05))+
# geom_line(position = position_dodge(0.05))+
# geom_errorbar(aes(ymin = mean_ab_n - std_err, ymax = mean_ab_n + std_err), width = 0.2,
# position = position_dodge(0.05))+
geom_point(position = position_jitter(width = 0.05, seed = 1))+
geom_line(position = position_jitter(width = 0.05, seed = 1))+
geom_errorbar(aes(ymin = mean_ab_n - std_err, ymax = mean_ab_n + std_err), width = 0.2,
position = position_jitter(width = 0.05, seed = 1))+
# scale_colour_manual(values = cbp2)+
theme_bw()+
ylab(bquote('Average count (abalone.10'*~min^-1*')'))+
xlab('Survey Year')+
ylim(-1, 35)+
theme(legend.position = 'bottom',
legend.background = element_rect(fill = "white", colour = NA))+
guides(colour = guide_legend(title = "Size Class"))+
facet_wrap(. ~ blockno, ncol = 3)
abundance_plot_sub <- ten_min_mean_year %>%
filter(blockno != 13 & legal_size == '<140 mm') %>%
ggplot(aes(x = sampyear, y = mean_ab_n, group = sizeclass_2021, colour = sizeclass_2021))+
# geom_point(position = position_dodge(0.05))+
# geom_line(position = position_dodge(0.05))+
# geom_errorbar(aes(ymin = mean_ab_n - std_err, ymax = mean_ab_n + std_err), width = 0.2,
# position = position_dodge(0.05))+
geom_point(position = position_jitter(width = 0.05, seed = 1))+
geom_line(position = position_jitter(width = 0.05, seed = 1))+
geom_errorbar(aes(ymin = mean_ab_n - std_err, ymax = mean_ab_n + std_err), width = 0.2,
position = position_jitter(width = 0.05, seed = 1))+
# scale_colour_manual(values = cbp2)+
theme_bw()+
ylab(bquote('Average count (abalone.10'*~min^-1*')'))+
xlab('Survey Year')+
ylim(-1, 35)+
theme(legend.position = 'bottom',
legend.background = element_rect(fill = "white", colour = NA))+
guides(colour = guide_legend(title = "Size Class"))+
facet_wrap(. ~ blockno, ncol = 3)
abundance_plot_legal
abundance_plot_sub
ggsave(filename = paste(ts_plots_folder, paste('/TimedSwimSurvey_', samp_year, '_TenMinuteCount_SizeClasses_MeanLinePlot_Sub-Legal', '.pdf', sep = ''), sep = ''), plot = abundance_plot_sub, units = 'mm', width = 190, height = 200)
ggsave(filename = paste(ts_plots_folder, paste('/TimedSwimSurvey_', samp_year, '_TenMinuteCount_SizeClasses_MeanLinePlot_Sub-Legal', '.png', sep = ''), sep = ''), plot = abundance_plot_sub, units = 'mm', width = 190, height = 200)
ggsave(filename = paste(ts_plots_folder, paste('/TimedSwimSurvey_', samp_year, '_TenMinuteCount_SizeClasses_MeanLinePlot_Legal', '.pdf', sep = ''), sep = ''), plot = abundance_plot_legal, units = 'mm', width = 190, height = 200)
ggsave(filename = paste(ts_plots_folder, paste('/TimedSwimSurvey_', samp_year, '_TenMinuteCount_SizeClasses_MeanLinePlot_Legal', '.png', sep = ''), sep = ''), plot = abundance_plot_legal, units = 'mm', width = 190, height = 200)
```
Is the decline in sub-legal abundance being driven by the recruitment of animals into what would be the fishery (140 mm) particularly those in the 120-140 mm, or is this been driven by a decline in juvenile recruitment into the population/stock, or a combination of both?Declining sub-legal abundance particularity 0-100 mm and 100-120 mm suggesting a decline in juvenile recruitment. Increasing legal abundance - not unexpected given closure and sub-legal animals, particularity 120-140 mm attaining the LML (140 mm). Also increasing 160-180 mm and larger size classes >180 mm relatively stable.
```{r}
#| label: fig-count-sizeclass-subblock-lineplot
#| fig-cap: "Average count of each abalone size class within 10 minutes between paired divers at each site within each subblock by year."
#| echo: false
#| warning: false
#| message: false
#| fig-height: 7
#| fig-width: 7
#| out-height: 90%
#| fig-pos: "H"
block_no <- 16
# Arrange size classes in order
sizeclasses <- c("0-100", "100-120", "120-140", "140-160", "160-180", "180-200", "200-220")
# Colour palette
cbp2 <- c("#D55E00", "#000000", "#009E73", "#0072B2", "#999999", "#CC79A7", "#E69F00")
cbp2 <- c('#FF0000', '#FFA07A', '#F08080','#0000FF', '#4169E1', '#00BFFF', '#ADD8E6')
# Determine mean abalone abundance in each block, year and size class
ten_min_mean_year <- time_swim_dat_final %>%
mutate(sizeclass_2021 = factor(sizeclass_2021, levels = sizeclasses)) %>%
filter((!subblockno %in% c('28B', '28C') &
!blockno %in% c('13', '14', '21', '29', '30') &
!is.na(sizeclass_freq_10) &
sampyear <= samp_year) &
blockno == block_no) %>%
group_by(blockno, subblockno, site, diver, sampyear, time_elapsed, sizeclass_2021, legal_size) %>%
summarise(ab_n = sum(sizeclass_freq_10)) %>%
group_by(blockno, subblockno, sampyear, sizeclass_2021, legal_size) %>%
summarise(mean_ab_n = mean(ab_n),
median_ab_n = median(ab_n),
std_err = sd(ab_n)/sqrt(n()))
abundance_plot <- ten_min_mean_year %>%
filter(blockno != 13 & legal_size == '<140 mm') %>%
ggplot(aes(x = sampyear, y = mean_ab_n, group = sizeclass_2021, colour = sizeclass_2021))+
# geom_point(position = position_dodge(0.05))+
# geom_line(position = position_dodge(0.05))+
# geom_errorbar(aes(ymin = mean_ab_n - std_err, ymax = mean_ab_n + std_err), width = 0.2,
# position = position_dodge(0.05))+
geom_point(position = position_jitter(width = 0.05, seed = 1))+
geom_line(position = position_jitter(width = 0.05, seed = 1))+
geom_errorbar(aes(ymin = mean_ab_n - std_err, ymax = mean_ab_n + std_err), width = 0.2,
position = position_jitter(width = 0.05, seed = 1))+
# scale_colour_manual(values = cbp2)+
theme_bw()+
ylab(bquote('Average count (abalone.10'*~min^-1*')'))+
xlab('Survey Year')+
ylim(-1, 35)+
theme(legend.position = 'bottom',
legend.background = element_rect(fill = "white", colour = NA))+
guides(colour = guide_legend(title = "Size Class"))+
facet_wrap(. ~ subblockno, ncol = 3)
abundance_plot
# ggsave(filename = paste(ts_plots_folder, paste('/TimedSwimSurvey_', samp_year, '_TenMinuteCount_SizeClasses_MeanLinePlot_Legal', '.pdf', sep = ''), sep = ''), plot = abundance_plot, units = 'mm', width = 190, height = 200)
# ggsave(filename = paste(ts_plots_folder, paste('/TimedSwimSurvey_', samp_year, '_TenMinuteCount_SizeClasses_MeanLinePlot_Legal', '.png', sep = ''), sep = ''), plot = abundance_plot, units = 'mm', width = 190, height = 200)
```
```{r}
#| label: fig-abs-change-2020
#| fig-cap: "Asolute change in average abundance of all legal (>140 mm) and sub-legal (<140 mm) abalone counted within 10 minutes between paired divers at each site within each block and year to 2020 baselines and the hypothetical percentage changes."
#| echo: false
#| warning: false
#| message: false
#| fig-height: 7
#| fig-width: 7
#| out-height: 90%
#| fig-pos: "H"
##---------------------------------------------------------------------------##
## PLOT 3: Relative-Absolute Abundance ####
# Relative abundance to 2020 baselines and hypothetical percentage change.
# Determine mean abalone abundance in each block, year and size class
ten_min_mean_year <- time_swim_dat_final %>%
filter(!subblockno %in% c('28B', '28C') &
!blockno %in% c('13', '14', '21', '29', '30') &
!is.na(sizeclass_freq_10)) %>%
group_by(blockno, site, diver, sampyear, time_elapsed, legal_size) %>%
summarise(ab_n = sum(sizeclass_freq_10)) %>%
group_by(blockno, sampyear, legal_size) %>%
summarise(mean_ab_n = mean(ab_n),
median_ab_n = median(ab_n),
std_err = sd(ab_n)/sqrt(n()))
# Extract basline abudance 2020 values
base_dat_2020 <- ten_min_mean_year %>%
filter(sampyear == 2020) %>%
dplyr::rename(mean_ab_n_2020 = 'mean_ab_n') %>%
ungroup() %>%
select(blockno, legal_size, mean_ab_n_2020)
# Re-join baseline data to all data
dat_base_year <- left_join(ten_min_mean_year, base_dat_2020)
# Relative and absolute difference
dat_diff <- dat_base_year %>%
mutate(rel_diff = (mean_ab_n - mean_ab_n_2020) / mean_ab_n_2020,
abs_diff = mean_ab_n - mean_ab_n_2020)
# Hypothetical scenarios
dat_hypo_abs <- dat_base_year %>%
filter(sampyear == 2020) %>%
mutate(hypo_05_2020 = 0,
hypo_05_2021 = (mean_ab_n_2020 * 1.05) - mean_ab_n_2020,
hypo_05_2022 = (mean_ab_n_2020 * 1.05^2) - mean_ab_n_2020,
hypo_05_2023 = (mean_ab_n_2020 * 1.05^3) - mean_ab_n_2020,
hypo_05_2024 = (mean_ab_n_2020 * 1.05^4) - mean_ab_n_2020,
hypo_10_2020 = 0,
hypo_10_2021 = (mean_ab_n_2020 * 1.10) - mean_ab_n_2020,
hypo_10_2022 = (mean_ab_n_2020 * 1.10^2) - mean_ab_n_2020,
hypo_10_2023 = (mean_ab_n_2020 * 1.10^3) - mean_ab_n_2020,
hypo_10_2024 = (mean_ab_n_2020 * 1.10^4) - mean_ab_n_2020,
hypo_15_2020 = 0,
hypo_15_2021 = (mean_ab_n_2020 * 1.15) - mean_ab_n_2020,
hypo_15_2022 = (mean_ab_n_2020 * 1.15^2) - mean_ab_n_2020,
hypo_15_2023 = (mean_ab_n_2020 * 1.15^3) - mean_ab_n_2020,
hypo_15_2024 = (mean_ab_n_2020 * 1.15^4) - mean_ab_n_2020,
hypo_20_2020 = 0,
hypo_20_2021 = (mean_ab_n_2020 * 1.20) - mean_ab_n_2020,
hypo_20_2022 = (mean_ab_n_2020 * 1.20^2) - mean_ab_n_2020,
hypo_20_2023 = (mean_ab_n_2020 * 1.20^3) - mean_ab_n_2020,
hypo_20_2024 = (mean_ab_n_2020 * 1.20^4) - mean_ab_n_2020,
hypo_25_2020 = 0,
hypo_25_2021 = (mean_ab_n_2020 * 1.25) - mean_ab_n_2020,
hypo_25_2022 = (mean_ab_n_2020 * 1.25^2) - mean_ab_n_2020,
hypo_25_2023 = (mean_ab_n_2020 * 1.25^3) - mean_ab_n_2020,
hypo_25_2024 = (mean_ab_n_2020 * 1.25^4) - mean_ab_n_2020) %>%
pivot_longer(cols = starts_with('hypo_'),
names_to = c('hypo', 'rate', 'yr'),
names_sep = '_',
values_to = 'hypo_val',
values_drop_na = T) %>%
select(hypo, legal_size, rate, yr, hypo_val)
#Absolute plot
abs_change_plot <- dat_diff %>%
ggplot() +
geom_point(aes(x = sampyear, y = abs_diff, group = legal_size, colour = legal_size), position = position_dodge(0.05)) +
geom_line(aes(x = sampyear, y = abs_diff, group = legal_size, colour = legal_size)) +
geom_hline(yintercept = 0, linetype = 'dotted', colour = 'red', size = 0.3) +
geom_line(data = dat_hypo_abs %>% filter(rate == '05' & legal_size == '<140 mm'), aes(x = as.numeric(yr), y = hypo_val, colour = rate), linetype = 'dashed', size = 0.3)+
geom_line(data = dat_hypo_abs %>% filter(rate == '10' & legal_size == '<140 mm'), aes(x = as.numeric(yr), y = hypo_val, colour = rate), linetype = 'dashed', size = 0.3)+
geom_line(data = dat_hypo_abs %>% filter(rate == '15' & legal_size == '<140 mm'), aes(x = as.numeric(yr), y = hypo_val, colour = rate), linetype = 'dashed', size = 0.3)+
geom_line(data = dat_hypo_abs %>% filter(rate == '20' & legal_size == '<140 mm'), aes(x = as.numeric(yr), y = hypo_val, colour = rate), linetype = 'dashed', size = 0.3)+
scale_colour_manual(values = c('red', 'blue', "#00AFBB", "#E7B800", "#FC4E07", "#52854C"),
labels = c('<140 mm', '>140 mm', '5%', '10%', '15%', '20%'),
name = '') +
# scale_colour_manual(values = c('red', 'blue'),
# labels = c('<140 mm', '>140 mm'),
# name = 'Size Class') +
theme_bw() +
ylab(bquote('Absolute change in abundance')) +
xlab('Survey Year') +
theme(legend.position = 'bottom') +
# theme(legend.position = c(0.9, 0.3)
# ,legend.background = element_rect(fill = NA, colour = NA))+
guides(colour = guide_legend(nrow =1)) +
# ylim(-30, 100)+
facet_wrap(. ~ blockno, ncol = 3)
abs_change_plot
ggsave(filename = paste(ts_plots_folder, paste('/TimedSwimSurvey_', samp_year, '_TenMinuteCount_AbsoluteChangePlot', '.pdf', sep = ''), sep = ''), plot = abs_change_plot, units = 'mm', width = 190, height = 200)
ggsave(filename = paste(ts_plots_folder, paste('/TimedSwimSurvey_', samp_year, '_TenMinuteCount_AbsoluteChangePlot', '.png', sep = ''), sep = ''), plot = abs_change_plot, units = 'mm', width = 190, height = 200)
```
```{r}
#| label: fig-ref-abs-change-2020
#| fig-cap: "Asolute change in average abundance of all legal (>140 mm) and sub-legal (<140 mm) abalone counted within 10 minutes between paired divers at each reference site within each block and year to 2020 baselines and the hypothetical percentage changes."
#| echo: false
#| warning: false
#| message: false
#| fig-height: 7
#| fig-width: 7
#| out-height: 90%
#| fig-pos: "H"
##---------------------------------------------------------------------------##
## PLOT 3: Relative-Absolute Abundance ####
# Relative abundance to 2020 baselines and hypothetical percentage change.
# Determine mean abalone abundance in each block, year and size class
ten_min_mean_year <- time_swim_dat_final %>%
filter(!subblockno %in% c('28B', '28C') &
!blockno %in% c('13', '14', '21', '29', '30') &
!is.na(sizeclass_freq_10) &
ref_site == 1) %>%
group_by(blockno, site, diver, sampyear, time_elapsed, legal_size) %>%
summarise(ab_n = sum(sizeclass_freq_10)) %>%
group_by(blockno, sampyear, legal_size) %>%
summarise(mean_ab_n = mean(ab_n),
median_ab_n = median(ab_n),
std_err = sd(ab_n)/sqrt(n()))
# Extract basline abudance 2020 values
base_dat_2020 <- ten_min_mean_year %>%
filter(sampyear == 2020) %>%
dplyr::rename(mean_ab_n_2020 = 'mean_ab_n') %>%
ungroup() %>%
select(blockno, legal_size, mean_ab_n_2020)
# Re-join baseline data to all data
dat_base_year <- left_join(ten_min_mean_year, base_dat_2020)
# Relative and absolute difference
dat_diff <- dat_base_year %>%
mutate(rel_diff = (mean_ab_n - mean_ab_n_2020) / mean_ab_n_2020,
abs_diff = mean_ab_n - mean_ab_n_2020)
# Hypothetical scenarios
dat_hypo_abs <- dat_base_year %>%
filter(sampyear == 2020) %>%
mutate(hypo_05_2020 = 0,
hypo_05_2021 = (mean_ab_n_2020 * 1.05) - mean_ab_n_2020,
hypo_05_2022 = (mean_ab_n_2020 * 1.05^2) - mean_ab_n_2020,
hypo_05_2023 = (mean_ab_n_2020 * 1.05^3) - mean_ab_n_2020,
hypo_05_2024 = (mean_ab_n_2020 * 1.05^4) - mean_ab_n_2020,
hypo_10_2020 = 0,
hypo_10_2021 = (mean_ab_n_2020 * 1.10) - mean_ab_n_2020,
hypo_10_2022 = (mean_ab_n_2020 * 1.10^2) - mean_ab_n_2020,
hypo_10_2023 = (mean_ab_n_2020 * 1.10^3) - mean_ab_n_2020,
hypo_10_2024 = (mean_ab_n_2020 * 1.10^4) - mean_ab_n_2020,
hypo_15_2020 = 0,
hypo_15_2021 = (mean_ab_n_2020 * 1.15) - mean_ab_n_2020,
hypo_15_2022 = (mean_ab_n_2020 * 1.15^2) - mean_ab_n_2020,