-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRiskIndicators.html
2094 lines (2064 loc) · 237 KB
/
RiskIndicators.html
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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
<meta charset="utf-8">
<meta name="generator" content="quarto-1.5.57">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>Food Web Model Risk Indicators</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
ul.task-list li input[type="checkbox"] {
width: 0.8em;
margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
vertical-align: middle;
}
/* CSS for syntax highlighting */
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { display: inline-block; text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
}
pre.numberSource { margin-left: 3em; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
</style>
<script src="RiskIndicators_files/libs/clipboard/clipboard.min.js"></script>
<script src="RiskIndicators_files/libs/quarto-html/quarto.js"></script>
<script src="RiskIndicators_files/libs/quarto-html/popper.min.js"></script>
<script src="RiskIndicators_files/libs/quarto-html/tippy.umd.min.js"></script>
<script src="RiskIndicators_files/libs/quarto-html/anchor.min.js"></script>
<link href="RiskIndicators_files/libs/quarto-html/tippy.css" rel="stylesheet">
<link href="RiskIndicators_files/libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
<script src="RiskIndicators_files/libs/bootstrap/bootstrap.min.js"></script>
<link href="RiskIndicators_files/libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
<link href="RiskIndicators_files/libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
<link href="RiskIndicators_files/libs/htmltools-fill-0.5.8.1/fill.css" rel="stylesheet">
<script src="RiskIndicators_files/libs/htmlwidgets-1.6.4/htmlwidgets.js"></script>
<link href="RiskIndicators_files/libs/datatables-css-0.0.0/datatables-crosstalk.css" rel="stylesheet">
<script src="RiskIndicators_files/libs/datatables-binding-0.33/datatables.js"></script>
<script src="RiskIndicators_files/libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
<link href="RiskIndicators_files/libs/dt-core-1.13.6/css/jquery.dataTables.min.css" rel="stylesheet">
<link href="RiskIndicators_files/libs/dt-core-1.13.6/css/jquery.dataTables.extra.css" rel="stylesheet">
<script src="RiskIndicators_files/libs/dt-core-1.13.6/js/jquery.dataTables.min.js"></script>
<link href="RiskIndicators_files/libs/crosstalk-1.2.1/css/crosstalk.min.css" rel="stylesheet">
<script src="RiskIndicators_files/libs/crosstalk-1.2.1/js/crosstalk.min.js"></script>
</head>
<body class="fullcontent">
<div id="quarto-content" class="page-columns page-rows-contents page-layout-article">
<main class="content" id="quarto-document-content">
<header id="title-block-header" class="quarto-title-block default">
<div class="quarto-title">
<h1 class="title">Food Web Model Risk Indicators</h1>
</div>
<div class="quarto-title-meta">
</div>
</header>
<section id="overview" class="level1">
<h1>Overview</h1>
<p>We want to develop indicators of prey availability and predation pressure for the Mid-Atlantic EAFM risk assessment. We will use the MAB Rpath model by Brandon Beltz to characterize diet composition and predation mortality for fish species managed by the Mid Atlantic Fishery Management Council (MAFMC).</p>
<p>The current ecological risk elements are outlined below.</p>
</section>
<section id="food-web-prey-availability" class="level1">
<h1>Food web: Prey availability</h1>
<p>This element is applied at the species level.</p>
<p>Fish stocks and protected species stocks are managed using single species approaches, but fish and protected species stocks exist within a food web of predator and prey interactions. This element is one of two separating food web risks to achieving OY for Council managed species from two sources. This first element assesses prey availability for each species, and the second food web risk element assesses predation pressure on each species (see next element).</p>
<p>Proposed definition:</p>
<p>Risk of not achieving OY for Council managed species due to availability of prey.</p>
<p>Indicators:</p>
<p>Indicators of prey availability for each Council managed species could be based on food habits information for the Council managed species combined with population trends for key prey species (if available). Prey could include all species (Council managed, other-managed, and non-managed) or a subset as determined by the EOP and Council.</p>
<p>The MAB Rpath model was used to characterize prey into groups for each of the Council managed species.</p>
<p>Diet plots for each predator? Compare with diet comp from NEFSC diet database <a href="https://fwdp.shinyapps.io/tm2020/">here</a>?</p>
<p>Ratio of council managed prey to total prey?</p>
<p>Alternative indirect indicators of prey availability could include the fish condition indicators from the State of the Ecosystem report (shown below under Ecosystem Productivity). These would not rely on detailed diet information, instead reflecting the impact of environmental drivers including prey availability on fish growth.</p>
<p>Diet information was gathered from the Northeast Fisheries Science Center (NEFSC) food habits database and other sources <span class="citation" data-cites="smith_trophic_2010 johnson_growth_2008">[@smith_trophic_2010; @johnson_growth_2008]</span>.</p>
<p>Potential risk criteria:</p>
<div class="cell" data-warnings="false">
<table class="caption-top table table-sm table-striped small">
<colgroup>
<col style="width: 22%">
<col style="width: 77%">
</colgroup>
<thead>
<tr class="header">
<th style="text-align: left;">Risk Level</th>
<th style="text-align: left;">Definition</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">Low</td>
<td style="text-align: left;">Prey availability high (not limiting) and/or good fish condition past 5 years</td>
</tr>
<tr class="even">
<td style="text-align: left;">Low-Moderate</td>
<td style="text-align: left;">Aggregate prey available for this species has stable or increasing trend, moderate condition</td>
</tr>
<tr class="odd">
<td style="text-align: left;">Moderate-High</td>
<td style="text-align: left;">Aggregate prey available for this species has significant decreasing trend, poor condition</td>
</tr>
<tr class="even">
<td style="text-align: left;">High</td>
<td style="text-align: left;">Managed species highly dependent on prey with limited and declining availability, poor condition</td>
</tr>
</tbody>
</table>
</div>
<div style="page-break-after: always;"></div>
<section id="rpath-outputs" class="level2">
<h2 class="anchored" data-anchor-id="rpath-outputs">Rpath Outputs</h2>
<p>Indicators from models will be EPU specific since models are EPU specific</p>
<p>Indicators from NEFSC diet data can also be region specific</p>
<p>Steps: Load model</p>
<p>Get the new model that Sarah revised from here</p>
<p>https://github.com/Nyelab/MAB-Rpath/blob/balance_prep/outputs/MAB_Rpath.RData</p>
<p>and</p>
<p>https://github.com/Nyelab/MAB-Rpath/blob/balance_prep/outputs/MAB_params_Rpath.RData</p>
<p>Correction! July 2024</p>
<p>New model is at <code>[email protected]:Nyelab/MAB-Rpath.git</code> branch <code>max_clam_edits</code></p>
<p>New model is now in local directory for this repo</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="co">#load("fwmods/MAB Rpath - BALANCED - July 2022.RData")</span></span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="co">#load("fwmods/MAB_Rpath.RData")</span></span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a><span class="co">#load("fwmods/MAB_params_Rpath.RData")</span></span>
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a><span class="fu">load</span>(<span class="st">"fwmods/MAB_Rpath_no_disc.RData"</span>)</span>
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a><span class="fu">load</span>(<span class="st">"fwmods/MAB_params_Rpath_no_disc.RData"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
<p>Is it in? Test view</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>Rpath<span class="sc">::</span><span class="fu">webplot</span>(MAB.rpath, <span class="at">labels =</span> T, <span class="at">highlight =</span> <span class="st">"SummerFlounder"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="RiskIndicators_files/figure-html/unnamed-chunk-2-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
<p>Model parameters</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb3"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a>DT<span class="sc">::</span><span class="fu">datatable</span>(MAB.rpath.params<span class="sc">$</span>model)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">
<div class="datatables html-widget html-fill-item" id="htmlwidget-a25c7d13ad78bf6a691e" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-a25c7d13ad78bf6a691e">{"x":{"filter":"none","vertical":false,"data":[["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"],["AmLobster","RiverHerring","AtlCroaker","AtlMackerel","AtlScallop","Bacteria","BaleenWhales","BlackSeaBass","Bluefish","Butterfish","Cod","Fourspot","GelZooplankton","Goosefish","HMS","Illex","LgCopepods","LittleSkate","Loligo","Macrobenthos","Megabenthos","Mesopelagics","Micronekton","Microzooplankton","OceanPout","OceanQuahog","Odontocetes","OtherCephalopods","OtherDemersals","OtherPelagics","OtherShrimps","OtherSkates","Phytoplankton","RedHake","Scup","SeaBirds","Sharks","SilverHake","SmCopepods","SmFlatfishes","SmoothDogfish","SmPelagics","SouthernDemersals","SpinyDogfish","SummerFlounder","SurfClam","Weakfish","Windowpane","WinterFlounder","WinterSkate","YTFlounder","Krill","AtlMenhaden","Detritus","Fixed Gear","LG Mesh","HMS Fleet","Scallop Dredge","Trap","Other Dredge","Other","Clam Dredge","Pelagic","SM Mesh","Recreational","PurseSeine"],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,3,3,3,3,3,3,3,3,3,3,3],[0.08188272954579383,0.1055711852729902,0.6785268180970451,0.3253308359323001,2.434684365050205,7.157778,0.16,0.128363685158036,0.9790211264182481,2.118555826856122,0.04190216572039959,0.2786104250194046,0.4683606,0.4673924658477865,0.032,0.2849433242150368,3.665501446516124,0.6040877438417805,1.801241092126709,45,7.933486,null,3.5656191,4.72086,0.1325885453637372,4.711326795163682,0.092475345,null,null,null,null,null,20.0455,0.3977380348444098,1.565637223644404,0.002948594,0.2106240255,0.7126335197248683,7.242212502679905,null,0.5776139693082299,null,0.7286777090813209,1.926351907735356,0.2700595812683554,10.02490752020197,0.3180372876391421,0.2063978791867066,0.1969040473515054,0.3138578314506114,0.2203976796613357,0.52435575,1.775190819,null,null,null,null,null,null,null,null,null,null,null,null,null],[1.5,1.3,1.02,0.6899999999999999,1.5,91.25,0.06,0.5,0.6,1.64,0.4,0.45,35,0.4,0.58,3,61,0.5,3,2.5,2.5,2.2,14.25,72,0.57,0.05,0.07000000000000001,3,0.65,1.2,2,0.55,195.45,0.45,0.45,0.28,0.16,0.6,52.17,1.64,0.5,2,1.14,0.2,0.7,1.5,1.02,0.25,0.57,0.15,0.9,14.25,1.45,null,null,null,null,null,null,null,null,null,null,null,null,null],[15.533,9.4,3.727232558,2.17,6.66,380.2082,4.308693137,1.66,3.5,4.23,1.2,1.61,146,1.22,2.263333333333333,19,148,1.4,19,16.84234942,15.533,3.7,70.94690325000001,242.4242482,2,0.3,10.669826596,19,1.740893617,4,6.66,1.1,0,0.9399999999999999,1.66,76.2,0.875,3.06,127.75,5.39,2.44,5.39,3.727232558,1.16,3.336863905,6.66,3.727232558,0.92,2.024,0.9,3.234412371,36.5,5.39,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0.95,null,null,null,null,null,0.85,0.9,0.85,0.85,0.85,null,null,null,null,null,null,null,0.85,null,0.9,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],[0,0,0.029141369,0,0.015226466,0,0,0,0,0,-0.05,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-0.006636141,0.010330339,0,0,0,0,0,0,0,0,-0.06305372300000001,0,0,0,0,0,0,-0.010274643,0,0,0,null,null,null,null,null,null,null,null,null,null,null,null],[0.3,0.2,0.2,0.2,0.3,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.4,0.2,0.2,0.3,0.3,0.2,0.2,0.4,0.2,0.2,0.2,0.2,0.2,0.2,0.3,0.2,0,0.2,0.2,0.2,0.2,0.2,0.4,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0,null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0,null,null,null,null,null,null,null,null,null,null,null,null],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1],[2.384944627094647e-05,4.688738449690847e-05,2.95947349295259e-07,0.002120495132165248,0,0,0,0.0003129169117757013,0.005055349495417279,0.0008236348922087402,0.002846292478589134,0,0,0.0001688777271483599,2.355523861471685e-05,0,0,1.713058713806165e-05,0.0009631240368415282,0.0001070802374922695,1.922036141107977e-05,0,0,0,7.8590504017208e-08,5.448674485655179e-05,0,0.004224509776038285,0.0004329268037538015,0.005920874550754572,0,4.673129534129454e-06,0,2.196287513908734e-05,0.0112912188206914,0,5.573958526432382e-05,0.0001312874768015996,0,0,8.128416922424579e-07,1.824332975107761e-06,4.666080475366614e-05,9.978087855519948e-06,0.0004697809142458953,0.0001330830634974722,0.002784027539291864,4.010677843409157e-06,0.000130626290071882,2.061653427660681e-05,3.797559105422601e-05,0,0,0,null,null,null,null,null,null,null,null,null,null,null,null],[4.668890035843317e-05,8.797339013297425e-07,7.957335030092248e-05,0.003827299131506588,0.0001297831826689435,0,0,0.0004375934527977787,0.001448341598958238,0.01317701406000881,0.009644064294120857,1.999162791288646e-06,0,0.004641927777506764,1.422853739802261e-06,0.0004932773390661095,0,0.0001305796781443237,0.002772467832326689,5.635914495633437e-05,0.0001572519872778724,0,0,0,0.0003986388706591412,0,0,0.0001215776713936109,0.01148305673030449,2.577208166779547e-05,0,1.220362692840121e-06,0,0.003042461771223501,0.01154483604802963,0,2.020548229018334e-05,0.0258654258262371,0,0,1.97696883402511e-05,0,7.00965486062294e-05,0.001331438745966424,0.01963247642801192,7.374359292713371e-06,0.004876856358299223,0.003939156184987495,0.01356732455030211,0.0001801938683040188,0.03663519851801179,0,0,0,null,null,null,null,null,null,null,null,null,null,null,null],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,null,null,null,null,null,null,null,null,null],[0,0,0,0,0.001278449373333318,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,null,null,null,null,null,null,null,null,null],[0.0163935731586768,0,3.243258622413797e-08,1.450850854036199e-06,2.151496688643753e-05,0,0,0.001819784533446682,4.783806468060351e-07,0.003193455540756928,7.892182227692336e-06,0,0,0.0002061253017475089,0,0,0,0,0,0.002026277446219426,0.007996674816197754,0,0,0,8.864202483566008e-05,0,0,2.104246232718306e-07,0.04409655535446059,0,0,0,0,0.0005551317817776726,2.111741962234389e-06,0,0,0,0,0,0,0,0,0,0.02356144815814492,0.0002606181277139777,1.743251509547416e-07,0,1.154059526475576e-06,0,0.01765411689646417,0,0,0,null,null,null,null,null,null,null,null,null,null,null,null],[1.110844418999711e-06,0,0,2.027036639008623e-07,0,0,0,0,0,4.054073278017246e-07,0,0,0,7.256791167650872e-07,0,0,0,0,2.63514763071121e-07,0.0142425405095111,0.0005096179570920375,0,0,0,0,0,0,0,0.0001710818923323278,0,0,0,0,4.929753106068971e-06,0,0,0,8.71625754773708e-06,0,0,0,0,0,0,0,5.351376726982765e-07,0,2.027036639008623e-07,5.554080390883627e-06,0,3.040554958512935e-07,0,0,0,null,null,null,null,null,null,null,null,null,null,null,null],[0,1.297303448965519e-05,0,0,0,0,0,1.216221983405174e-07,0,7.082466016696131e-05,0,0,0,0,0,0,0,0,0,0.002333521876111208,3.081095691293107e-06,0,0,0,0,0,0,3.703395939468754e-05,0,0,0,0,0,0,6.608139443168112e-06,0,0,0,0,0,0,0,2.128793878286856e-05,0,2.001086035788621e-07,6.17516441707587e-05,0,0,1.532733654009819e-05,0,0,0,0,0,null,null,null,null,null,null,null,null,null,null,null,null],[2.027036639008623e-08,0,0,0,1.347168550285131e-05,0,0,0,0,0,0,0,0,7.197804401455721e-05,0,0,0,0,0,6.949747779784571e-05,0.0001651568642365056,0,0,0,0,0.1320392540894965,0,0,0,0,0,0,0,1.013518319504312e-07,0,0,0,0,0,0,0,0,0,0,2.716432668578816e-07,0.1633077239925923,0,0,0,0,0,0,0,0,null,null,null,null,null,null,null,null,null,null,null,null],[0,0.0001560250641777718,5.91894698590518e-06,0.002321451169676938,2.431261469243913e-05,0,0,7.610636130485974e-07,0.0006430283144986908,1.402031586195044e-05,1.936684451537554e-06,0,0,1.330165337341941e-05,1.962171466560348e-06,4.054073278017247e-08,0,8.24835033414559e-08,7.270441410628692e-06,1.864873707887934e-07,0,0,0,0,0,0,0,2.419883167626053e-06,0.0002596382882721962,0.1040075850842568,0,1.085089600727511e-06,0,5.680891010178434e-08,0.001222696248125949,0,5.029753580260063e-06,1.103306833191744e-05,0,0,0,0,3.33082660521897e-05,0,7.549575651005564e-06,0,0.001960290090774129,2.821968079213094e-07,6.074991582837201e-07,0,1.414649056543311e-07,0,0,0,null,null,null,null,null,null,null,null,null,null,null,null],[0.0001847552206505754,9.730383978233094e-05,0.0002982453404038394,0.01039512006104826,0.0001930090866656666,0,0,0.005552836200853492,0.003926582652534272,0.04944918354362095,0.004638398821479857,0,0,0.01031636255865491,6.397963078979342e-06,0.02316111624634819,0,0.0003580935460534157,0.02811754760721548,0.0003218037992072661,0.001778913640648654,1.621629311206899e-08,0,0,0.002608065696337102,0,0,0.001672197298277909,0.005514124851023509,0.0001062775309832221,0,4.791566875616929e-05,0,0.006453533219080662,0.0310261258020999,0,4.65208516495896e-05,0.07223623301102669,0,0,2.811310138231869e-05,0,0.0002104349798862146,0.004818593457340698,0.04885689982139809,2.391903234030175e-05,0.00604237124027287,0.001773658423517016,0.01752747406926556,0.0003409907800597133,0.03174899607532954,0,0,0,null,null,null,null,null,null,null,null,null,null,null,null],[0,4.303477144298848e-05,0.003085748084370596,0.01376928710596981,0,0,0,0.01553269651766045,0.3079274885555382,4.089327256082105e-06,0.04094186615210211,0,0,8.735321492557074e-05,0,0,0,0,0,0,0,9.848464991647374e-06,0,0,0,0,0,0,0.02305606512707572,0.01427388436320028,0,0.003172487714220872,0,0.002666713643846907,0.003890540023136802,0,0.02355564089726023,0.0006572076570652176,0,0,0.001008990164119088,0,0.03169403627466051,0.007022570057020875,0.04111820715593811,0,0.02999513352765338,0.0003698715306306659,0,0,0,0,0,0,null,null,null,null,null,null,null,null,null,null,null,null],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.35,0,null,null,null,null,null,null,null,null,null,null,null,null],[0,0,0,0,0,0,0,0,2.216077162292853e-05,0,4.057348003020545e-06,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,null,null,null,null,null,null,null,null,null],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,null,null,null,null,null,null,null,null,null],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,null,null,null,null,null,null,null,null,null],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,null,null,null,null,null,null,null,null,null],[0.003480952709347295,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.002608209075110586,0,0,0,1.721204365740973e-05,0,0,0,0.01564816628942175,0.001912857678959697,0,0,0,0,0,0,0.0002745038856993467,0,0,0,0,0,2.435800325211027e-05,0,0,0,0,0,0,0,0,0,0,0,null,null,null,null,null,null,null,null,null,null,null,null],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,null,null,null,null,null,null,null,null,null],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6.758814205206741e-06,0,0,0,0,0,0,0,0,0,0,0,null,null,null,null,null,null,null,null,null,null,null,null],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,null,null,null,null,null,null,null,null,null],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0001182993313734685,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,null,null,null,null,null,null,null,null,null],[0,0,0,0.000267133476202308,2.744055477495936e-06,0,0,0,0,0.001866171042382716,0,0,0,6.526456091289123e-05,0,6.610264486330681e-05,0,0,0.0002544626046367586,0,6.431041258930493e-06,0,0,0,2.338683409150739e-05,0,0,0,0.0001788969008656165,0,0,3.748970922582469e-06,0,0.0005197430470158554,0.002917763538223307,0,0,0.004322714475553319,0,0,0,0,0,0.0009039106139916123,0.0008080137115055918,0,0,0,1.768531364505864e-05,0,0.0002670691199616879,0,0,0,null,null,null,null,null,null,null,null,null,null,null,null],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,null,null,null,null,null,null,null,null,null],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,null,null,null,null,null,null,null,null,null]],"container":"<table class=\"display\">\n <thead>\n <tr>\n <th> <\/th>\n <th>Group<\/th>\n <th>Type<\/th>\n <th>Biomass<\/th>\n <th>PB<\/th>\n <th>QB<\/th>\n <th>EE<\/th>\n <th>ProdCons<\/th>\n <th>BioAcc<\/th>\n <th>Unassim<\/th>\n <th>DetInput<\/th>\n <th>Detritus<\/th>\n <th>Fixed Gear<\/th>\n <th>LG Mesh<\/th>\n <th>HMS Fleet<\/th>\n <th>Scallop Dredge<\/th>\n <th>Trap<\/th>\n <th>Other Dredge<\/th>\n <th>Other<\/th>\n <th>Clam Dredge<\/th>\n <th>Pelagic<\/th>\n <th>SM Mesh<\/th>\n <th>Recreational<\/th>\n <th>PurseSeine<\/th>\n <th>Fixed Gear.disc<\/th>\n <th>LG Mesh.disc<\/th>\n <th>HMS Fleet.disc<\/th>\n <th>Scallop Dredge.disc<\/th>\n <th>Trap.disc<\/th>\n <th>Other Dredge.disc<\/th>\n <th>Other.disc<\/th>\n <th>Clam Dredge.disc<\/th>\n <th>Pelagic.disc<\/th>\n <th>SM Mesh.disc<\/th>\n <th>Recreational.disc<\/th>\n <th>PurseSeine.disc<\/th>\n <\/tr>\n <\/thead>\n<\/table>","options":{"columnDefs":[{"className":"dt-right","targets":[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]},{"orderable":false,"targets":0},{"name":" ","targets":0},{"name":"Group","targets":1},{"name":"Type","targets":2},{"name":"Biomass","targets":3},{"name":"PB","targets":4},{"name":"QB","targets":5},{"name":"EE","targets":6},{"name":"ProdCons","targets":7},{"name":"BioAcc","targets":8},{"name":"Unassim","targets":9},{"name":"DetInput","targets":10},{"name":"Detritus","targets":11},{"name":"Fixed Gear","targets":12},{"name":"LG Mesh","targets":13},{"name":"HMS Fleet","targets":14},{"name":"Scallop Dredge","targets":15},{"name":"Trap","targets":16},{"name":"Other Dredge","targets":17},{"name":"Other","targets":18},{"name":"Clam Dredge","targets":19},{"name":"Pelagic","targets":20},{"name":"SM Mesh","targets":21},{"name":"Recreational","targets":22},{"name":"PurseSeine","targets":23},{"name":"Fixed Gear.disc","targets":24},{"name":"LG Mesh.disc","targets":25},{"name":"HMS Fleet.disc","targets":26},{"name":"Scallop Dredge.disc","targets":27},{"name":"Trap.disc","targets":28},{"name":"Other Dredge.disc","targets":29},{"name":"Other.disc","targets":30},{"name":"Clam Dredge.disc","targets":31},{"name":"Pelagic.disc","targets":32},{"name":"SM Mesh.disc","targets":33},{"name":"Recreational.disc","targets":34},{"name":"PurseSeine.disc","targets":35}],"order":[],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
</div>
</div>
<p>Select MAFMC managed species</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="co"># or use existing ecodata lookup if names are the same?</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a>mafmc <span class="ot"><-</span> <span class="fu">c</span>(<span class="st">"AtlMackerel"</span>,</span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a> <span class="st">"BlackSeaBass"</span>,</span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a> <span class="st">"Bluefish"</span>,</span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a> <span class="st">"Butterfish"</span>,</span>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a> <span class="st">"Goosefish"</span>,</span>
<span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a> <span class="st">"Illex"</span>,</span>
<span id="cb4-9"><a href="#cb4-9" aria-hidden="true" tabindex="-1"></a> <span class="st">"Loligo"</span>,</span>
<span id="cb4-10"><a href="#cb4-10" aria-hidden="true" tabindex="-1"></a> <span class="st">"Scup"</span>,</span>
<span id="cb4-11"><a href="#cb4-11" aria-hidden="true" tabindex="-1"></a> <span class="st">"SpinyDogfish"</span>,</span>
<span id="cb4-12"><a href="#cb4-12" aria-hidden="true" tabindex="-1"></a> <span class="st">"SummerFlounder"</span>,</span>
<span id="cb4-13"><a href="#cb4-13" aria-hidden="true" tabindex="-1"></a> <span class="st">"SurfClam"</span>,</span>
<span id="cb4-14"><a href="#cb4-14" aria-hidden="true" tabindex="-1"></a> <span class="st">"OceanQuahog"</span>)<span class="co">#,</span></span>
<span id="cb4-15"><a href="#cb4-15" aria-hidden="true" tabindex="-1"></a> <span class="co">#"Clams", # Atlantic surfclam and ocean quahog not separate groups</span></span>
<span id="cb4-16"><a href="#cb4-16" aria-hidden="true" tabindex="-1"></a> <span class="co">#"Tilefish") # Blueline and golden tilefish not separate groups</span></span>
<span id="cb4-17"><a href="#cb4-17" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-18"><a href="#cb4-18" aria-hidden="true" tabindex="-1"></a>mafmc2 <span class="ot"><-</span> ecodata<span class="sc">::</span>species_groupings <span class="sc">|></span></span>
<span id="cb4-19"><a href="#cb4-19" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">filter</span>(Fed.Managed <span class="sc">%in%</span> <span class="fu">c</span>(<span class="st">"MAFMC"</span>, <span class="st">"JOINT"</span>)) <span class="sc">|></span></span>
<span id="cb4-20"><a href="#cb4-20" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">select</span>(COMNAME, SVSPP, SCINAME, Fed.Managed, RPATH, SOE<span class="fl">.20</span>) <span class="sc">|></span></span>
<span id="cb4-21"><a href="#cb4-21" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">distinct</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</section>
<section id="visualize-prey-compositions-lots-of-aggregate-groups" class="level2">
<h2 class="anchored" data-anchor-id="visualize-prey-compositions-lots-of-aggregate-groups">Visualize prey compositions (lots of aggregate groups)</h2>
<p>These can be the basis for selecting aggregate prey indices.</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb5"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a>MAFMCmoddiet <span class="ot"><-</span> MAB.rpath.params<span class="sc">$</span>diet <span class="sc">|></span></span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">as.data.frame</span>() <span class="sc">|></span></span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">select</span>(<span class="at">Prey=</span>Group, <span class="fu">all_of</span>(mafmc)) <span class="sc">|></span></span>
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">na.omit</span>() <span class="sc">|></span></span>
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a> tidyr<span class="sc">::</span><span class="fu">pivot_longer</span>(<span class="sc">-</span>Prey, <span class="at">names_to =</span> <span class="st">"Predator"</span>, <span class="at">values_to =</span> <span class="st">"Propdiet"</span>) <span class="sc">|></span></span>
<span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">mafmcprey =</span> <span class="fu">ifelse</span>(Prey <span class="sc">%in%</span> mafmc, <span class="cn">TRUE</span>, <span class="cn">FALSE</span>),</span>
<span id="cb5-7"><a href="#cb5-7" aria-hidden="true" tabindex="-1"></a> <span class="at">plotcol =</span> <span class="fu">ifelse</span>(mafmcprey, <span class="st">"blue"</span>, <span class="st">"lightgrey"</span>))</span>
<span id="cb5-8"><a href="#cb5-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb5-9"><a href="#cb5-9" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb5-10"><a href="#cb5-10" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb5-11"><a href="#cb5-11" aria-hidden="true" tabindex="-1"></a>dietplot <span class="ot"><-</span> <span class="fu">ggplot</span>(MAFMCmoddiet, <span class="fu">aes</span>(<span class="st">""</span>, Propdiet, <span class="at">fill=</span>mafmcprey)) <span class="sc">+</span></span>
<span id="cb5-12"><a href="#cb5-12" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_bar</span>(<span class="at">width =</span> <span class="dv">1</span>, <span class="at">size =</span> <span class="dv">1</span>, <span class="at">color =</span> <span class="st">"white"</span>, <span class="at">stat =</span> <span class="st">"identity"</span>) <span class="sc">+</span></span>
<span id="cb5-13"><a href="#cb5-13" aria-hidden="true" tabindex="-1"></a> <span class="co">#coord_polar("y") +</span></span>
<span id="cb5-14"><a href="#cb5-14" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_text</span>(<span class="fu">aes</span>(<span class="at">label =</span> <span class="fu">ifelse</span>( Propdiet<span class="sc">></span><span class="fl">0.05</span>, <span class="fu">paste0</span>(Prey, <span class="st">" "</span>, <span class="fu">round</span>(Propdiet<span class="sc">*</span><span class="dv">100</span>), <span class="st">"%"</span>), <span class="st">""</span>)), <span class="co">#\n</span></span>
<span id="cb5-15"><a href="#cb5-15" aria-hidden="true" tabindex="-1"></a> <span class="at">position =</span> <span class="fu">position_stack</span>(<span class="at">vjust =</span> <span class="fl">0.5</span>),</span>
<span id="cb5-16"><a href="#cb5-16" aria-hidden="true" tabindex="-1"></a> <span class="at">size=</span><span class="dv">3</span>) <span class="sc">+</span></span>
<span id="cb5-17"><a href="#cb5-17" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(<span class="at">x =</span> <span class="cn">NULL</span>, <span class="at">y =</span> <span class="cn">NULL</span>, <span class="at">fill =</span> <span class="cn">NULL</span>, </span>
<span id="cb5-18"><a href="#cb5-18" aria-hidden="true" tabindex="-1"></a> <span class="at">title =</span> <span class="st">"Diet"</span>) <span class="sc">+</span></span>
<span id="cb5-19"><a href="#cb5-19" aria-hidden="true" tabindex="-1"></a> <span class="fu">guides</span>(<span class="at">fill =</span> <span class="fu">guide_legend</span>(<span class="at">reverse =</span> <span class="cn">TRUE</span>)) <span class="sc">+</span></span>
<span id="cb5-20"><a href="#cb5-20" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_fill_manual</span>(<span class="at">values=</span><span class="fu">c</span>( <span class="st">"grey90"</span>, <span class="st">"lightblue"</span>)) <span class="sc">+</span></span>
<span id="cb5-21"><a href="#cb5-21" aria-hidden="true" tabindex="-1"></a> <span class="co">#scale_fill_viridis(discrete=TRUE) +</span></span>
<span id="cb5-22"><a href="#cb5-22" aria-hidden="true" tabindex="-1"></a> <span class="fu">theme_classic</span>() <span class="sc">+</span></span>
<span id="cb5-23"><a href="#cb5-23" aria-hidden="true" tabindex="-1"></a> <span class="fu">theme</span>(<span class="at">axis.line =</span> <span class="fu">element_blank</span>(),</span>
<span id="cb5-24"><a href="#cb5-24" aria-hidden="true" tabindex="-1"></a> <span class="at">axis.text =</span> <span class="fu">element_blank</span>(),</span>
<span id="cb5-25"><a href="#cb5-25" aria-hidden="true" tabindex="-1"></a> <span class="at">axis.ticks =</span> <span class="fu">element_blank</span>(),</span>
<span id="cb5-26"><a href="#cb5-26" aria-hidden="true" tabindex="-1"></a> <span class="at">plot.title =</span> <span class="fu">element_text</span>(<span class="at">hjust =</span> <span class="fl">0.5</span>, <span class="at">color =</span> <span class="st">"#666666"</span>),</span>
<span id="cb5-27"><a href="#cb5-27" aria-hidden="true" tabindex="-1"></a> <span class="at">legend.position=</span><span class="st">"none"</span>) <span class="sc">+</span></span>
<span id="cb5-28"><a href="#cb5-28" aria-hidden="true" tabindex="-1"></a> <span class="fu">facet_wrap</span>(<span class="sc">~</span>Predator)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
ℹ Please use `linewidth` instead.</code></pre>
</div>
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb7"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a>dietplot</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="RiskIndicators_files/figure-html/unnamed-chunk-5-1.png" class="img-fluid figure-img" width="960"></p>
</figure>
</div>
</div>
</div>
</section>
<section id="review-fish-condition-trends" class="level2">
<h2 class="anchored" data-anchor-id="review-fish-condition-trends">Review fish condition trends</h2>
<p>Which are “good” in the last 5 years?</p>
<p>Use ecodata fall condition as a starting point, ask for stock specific condition if available</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb8"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a>mafmc_cond <span class="ot"><-</span> <span class="fu">c</span>(<span class="st">"Atlantic mackerel"</span>,</span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a> <span class="st">"Black sea bass"</span>,</span>
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a> <span class="st">"Bluefish"</span>,</span>
<span id="cb8-4"><a href="#cb8-4" aria-hidden="true" tabindex="-1"></a> <span class="st">"Butterfish"</span>,</span>
<span id="cb8-5"><a href="#cb8-5" aria-hidden="true" tabindex="-1"></a> <span class="st">"Goosefish"</span>,</span>
<span id="cb8-6"><a href="#cb8-6" aria-hidden="true" tabindex="-1"></a> <span class="st">"Illex"</span>, <span class="co">#not in condition</span></span>
<span id="cb8-7"><a href="#cb8-7" aria-hidden="true" tabindex="-1"></a> <span class="st">"Loligo"</span>, <span class="co">#not in condition</span></span>
<span id="cb8-8"><a href="#cb8-8" aria-hidden="true" tabindex="-1"></a> <span class="st">"Scup"</span>,</span>
<span id="cb8-9"><a href="#cb8-9" aria-hidden="true" tabindex="-1"></a> <span class="st">"Spiny dogfish"</span>,</span>
<span id="cb8-10"><a href="#cb8-10" aria-hidden="true" tabindex="-1"></a> <span class="st">"Summer flounder"</span>,</span>
<span id="cb8-11"><a href="#cb8-11" aria-hidden="true" tabindex="-1"></a> <span class="st">"Surf clam"</span>, <span class="co">#not in condition</span></span>
<span id="cb8-12"><a href="#cb8-12" aria-hidden="true" tabindex="-1"></a> <span class="st">"Ocean quahog"</span>) <span class="co">#not in condition</span></span>
<span id="cb8-13"><a href="#cb8-13" aria-hidden="true" tabindex="-1"></a> <span class="co">#"Clams", # Atlantic surfclam and ocean quahog not separate groups</span></span>
<span id="cb8-14"><a href="#cb8-14" aria-hidden="true" tabindex="-1"></a> <span class="co">#"Tilefish") # Blueline and golden tilefish not separate groups</span></span>
<span id="cb8-15"><a href="#cb8-15" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-16"><a href="#cb8-16" aria-hidden="true" tabindex="-1"></a>fix<span class="ot"><-</span> ecodata<span class="sc">::</span>condition <span class="sc">|></span></span>
<span id="cb8-17"><a href="#cb8-17" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">group_by</span>(EPU, Var) <span class="sc">|></span></span>
<span id="cb8-18"><a href="#cb8-18" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">scaleCond =</span> <span class="fu">scale</span>(Value,<span class="at">scale =</span>T,<span class="at">center=</span>T))</span>
<span id="cb8-19"><a href="#cb8-19" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-20"><a href="#cb8-20" aria-hidden="true" tabindex="-1"></a> <span class="co"># finds quantiles</span></span>
<span id="cb8-21"><a href="#cb8-21" aria-hidden="true" tabindex="-1"></a> xs <span class="ot"><-</span> <span class="fu">quantile</span>(fix<span class="sc">$</span>scaleCond, <span class="fu">seq</span>(<span class="dv">0</span>,<span class="dv">1</span>, <span class="at">length.out =</span> <span class="dv">6</span>), <span class="at">na.rm =</span> <span class="cn">TRUE</span>)</span>
<span id="cb8-22"><a href="#cb8-22" aria-hidden="true" tabindex="-1"></a> <span class="co"># labels quantiles</span></span>
<span id="cb8-23"><a href="#cb8-23" aria-hidden="true" tabindex="-1"></a> fix <span class="ot"><-</span> fix <span class="sc">|></span></span>
<span id="cb8-24"><a href="#cb8-24" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">category =</span> <span class="fu">cut</span>(scaleCond,</span>
<span id="cb8-25"><a href="#cb8-25" aria-hidden="true" tabindex="-1"></a> <span class="at">breaks =</span> xs,</span>
<span id="cb8-26"><a href="#cb8-26" aria-hidden="true" tabindex="-1"></a> <span class="at">labels =</span> <span class="fu">c</span>( <span class="st">"Poor Condition"</span>,</span>
<span id="cb8-27"><a href="#cb8-27" aria-hidden="true" tabindex="-1"></a> <span class="st">"Below Average"</span>,</span>
<span id="cb8-28"><a href="#cb8-28" aria-hidden="true" tabindex="-1"></a> <span class="st">"Neutral"</span>,</span>
<span id="cb8-29"><a href="#cb8-29" aria-hidden="true" tabindex="-1"></a> <span class="st">"Above Average"</span>,</span>
<span id="cb8-30"><a href="#cb8-30" aria-hidden="true" tabindex="-1"></a> <span class="st">"Good Condition"</span>),</span>
<span id="cb8-31"><a href="#cb8-31" aria-hidden="true" tabindex="-1"></a> <span class="at">include.lowest =</span> <span class="cn">TRUE</span>))</span>
<span id="cb8-32"><a href="#cb8-32" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb8-33"><a href="#cb8-33" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-34"><a href="#cb8-34" aria-hidden="true" tabindex="-1"></a>mafmccond5 <span class="ot"><-</span> fix <span class="sc">|></span></span>
<span id="cb8-35"><a href="#cb8-35" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">filter</span>(Var <span class="sc">%in%</span> mafmc_cond,</span>
<span id="cb8-36"><a href="#cb8-36" aria-hidden="true" tabindex="-1"></a> Time <span class="sc">></span> <span class="fu">max</span>(Time, <span class="at">na.rm =</span> T)<span class="sc">-</span><span class="dv">5</span>) </span>
<span id="cb8-37"><a href="#cb8-37" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-38"><a href="#cb8-38" aria-hidden="true" tabindex="-1"></a>condquants <span class="ot"><-</span> <span class="fu">data.frame</span>(<span class="at">ymin =</span> xs[<span class="dv">1</span><span class="sc">:</span><span class="dv">5</span>],</span>
<span id="cb8-39"><a href="#cb8-39" aria-hidden="true" tabindex="-1"></a> <span class="at">ymax =</span> xs[<span class="dv">2</span><span class="sc">:</span><span class="dv">6</span>],</span>
<span id="cb8-40"><a href="#cb8-40" aria-hidden="true" tabindex="-1"></a> <span class="at">category =</span> <span class="fu">sort</span>(<span class="fu">unique</span>(fix<span class="sc">$</span>category))</span>
<span id="cb8-41"><a href="#cb8-41" aria-hidden="true" tabindex="-1"></a>)</span>
<span id="cb8-42"><a href="#cb8-42" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-43"><a href="#cb8-43" aria-hidden="true" tabindex="-1"></a>vir <span class="ot"><-</span> viridis<span class="sc">::</span><span class="fu">viridis_pal</span>()(<span class="dv">5</span>)</span>
<span id="cb8-44"><a href="#cb8-44" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-45"><a href="#cb8-45" aria-hidden="true" tabindex="-1"></a>mafmccondall <span class="ot"><-</span> fix <span class="sc">|></span></span>
<span id="cb8-46"><a href="#cb8-46" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">filter</span>(Var <span class="sc">%in%</span> mafmc_cond) </span>
<span id="cb8-47"><a href="#cb8-47" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-48"><a href="#cb8-48" aria-hidden="true" tabindex="-1"></a>p <span class="ot"><-</span> ggplot2<span class="sc">::</span><span class="fu">ggplot</span>() <span class="sc">+</span></span>
<span id="cb8-49"><a href="#cb8-49" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">theme_bw</span>() <span class="sc">+</span></span>
<span id="cb8-50"><a href="#cb8-50" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_rect</span>(<span class="at">data =</span> condquants,</span>
<span id="cb8-51"><a href="#cb8-51" aria-hidden="true" tabindex="-1"></a> <span class="fu">aes</span>(<span class="at">ymin =</span> ymin, <span class="at">ymax =</span> ymax, <span class="at">fill =</span> category, <span class="at">xmin =</span> <span class="sc">-</span><span class="cn">Inf</span>, <span class="at">xmax =</span> <span class="cn">Inf</span>),</span>
<span id="cb8-52"><a href="#cb8-52" aria-hidden="true" tabindex="-1"></a> <span class="at">alpha =</span> .<span class="dv">3</span>) <span class="sc">+</span></span>
<span id="cb8-53"><a href="#cb8-53" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">scale_fill_manual</span>(<span class="at">values=</span>vir) <span class="sc">+</span></span>
<span id="cb8-54"><a href="#cb8-54" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_point</span>(<span class="at">data=</span> mafmccondall, ggplot2<span class="sc">::</span><span class="fu">aes</span>(<span class="at">x=</span>Time, <span class="at">y=</span>scaleCond[,<span class="dv">1</span>])) <span class="sc">+</span></span>
<span id="cb8-55"><a href="#cb8-55" aria-hidden="true" tabindex="-1"></a> <span class="co">#ggplot2::geom_hline(yintercept = xs[2:5]) +</span></span>
<span id="cb8-56"><a href="#cb8-56" aria-hidden="true" tabindex="-1"></a> <span class="co">#ggplot2::geom_line() +</span></span>
<span id="cb8-57"><a href="#cb8-57" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">facet_grid</span>(Var<span class="sc">~</span><span class="fu">factor</span>(EPU, <span class="at">levels =</span> <span class="fu">c</span>(<span class="st">"MAB"</span>, <span class="st">"GB"</span>, <span class="st">"GOM"</span>, <span class="st">"SS"</span>, <span class="st">"NA"</span>)), ) <span class="sc">+</span></span>
<span id="cb8-58"><a href="#cb8-58" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">guides</span>(<span class="at">fill =</span> ggplot2<span class="sc">::</span><span class="fu">guide_legend</span>(<span class="at">reverse =</span> <span class="cn">TRUE</span>))</span>
<span id="cb8-59"><a href="#cb8-59" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-60"><a href="#cb8-60" aria-hidden="true" tabindex="-1"></a>p</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="RiskIndicators_files/figure-html/unnamed-chunk-6-1.png" class="img-fluid figure-img" width="960"></p>
</figure>
</div>
</div>
</div>
<p>Updated condition dataset with survey strata based EPU definitions</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb9"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a>AnnualRelCond2023_Fall <span class="ot"><-</span> readr<span class="sc">::</span><span class="fu">read_csv</span>(here<span class="sc">::</span><span class="fu">here</span>(<span class="st">"condition/AnnualRelCond2023_Fall.csv"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stderr">
<pre><code>Rows: 3414 Columns: 6
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (2): Species, EPU
dbl (4): YEAR, MeanCond, nCond, n
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.</code></pre>
</div>
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb11"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a>survEPUcond <span class="ot"><-</span> AnnualRelCond2023_Fall <span class="sc">|></span></span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">select</span>(<span class="at">Time =</span> YEAR,</span>
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a> <span class="at">Var =</span> Species,</span>
<span id="cb11-4"><a href="#cb11-4" aria-hidden="true" tabindex="-1"></a> EPU,</span>
<span id="cb11-5"><a href="#cb11-5" aria-hidden="true" tabindex="-1"></a> <span class="at">Value =</span> MeanCond,</span>
<span id="cb11-6"><a href="#cb11-6" aria-hidden="true" tabindex="-1"></a> nCond) <span class="sc">|></span></span>
<span id="cb11-7"><a href="#cb11-7" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">group_by</span>(EPU, Var) <span class="sc">|></span></span>
<span id="cb11-8"><a href="#cb11-8" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">scaleCond =</span> <span class="fu">scale</span>(Value,<span class="at">scale =</span>T,<span class="at">center=</span>T)) <span class="sc">|></span></span>
<span id="cb11-9"><a href="#cb11-9" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">category =</span> <span class="fu">cut</span>(scaleCond,</span>
<span id="cb11-10"><a href="#cb11-10" aria-hidden="true" tabindex="-1"></a> <span class="at">breaks =</span> xs,</span>
<span id="cb11-11"><a href="#cb11-11" aria-hidden="true" tabindex="-1"></a> <span class="at">labels =</span> <span class="fu">c</span>( <span class="st">"Poor Condition"</span>,</span>
<span id="cb11-12"><a href="#cb11-12" aria-hidden="true" tabindex="-1"></a> <span class="st">"Below Average"</span>,</span>
<span id="cb11-13"><a href="#cb11-13" aria-hidden="true" tabindex="-1"></a> <span class="st">"Neutral"</span>,</span>
<span id="cb11-14"><a href="#cb11-14" aria-hidden="true" tabindex="-1"></a> <span class="st">"Above Average"</span>,</span>
<span id="cb11-15"><a href="#cb11-15" aria-hidden="true" tabindex="-1"></a> <span class="st">"Good Condition"</span>),</span>
<span id="cb11-16"><a href="#cb11-16" aria-hidden="true" tabindex="-1"></a> <span class="at">include.lowest =</span> <span class="cn">TRUE</span>))</span>
<span id="cb11-17"><a href="#cb11-17" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb11-18"><a href="#cb11-18" aria-hidden="true" tabindex="-1"></a>mafmcsurvEPUcond <span class="ot"><-</span> survEPUcond <span class="sc">|></span></span>
<span id="cb11-19"><a href="#cb11-19" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">filter</span>(Var <span class="sc">%in%</span> mafmc_cond)</span>
<span id="cb11-20"><a href="#cb11-20" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb11-21"><a href="#cb11-21" aria-hidden="true" tabindex="-1"></a>p <span class="ot"><-</span> ggplot2<span class="sc">::</span><span class="fu">ggplot</span>() <span class="sc">+</span></span>
<span id="cb11-22"><a href="#cb11-22" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">theme_bw</span>() <span class="sc">+</span></span>
<span id="cb11-23"><a href="#cb11-23" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_rect</span>(<span class="at">data =</span> condquants,</span>
<span id="cb11-24"><a href="#cb11-24" aria-hidden="true" tabindex="-1"></a> <span class="fu">aes</span>(<span class="at">ymin =</span> ymin, <span class="at">ymax =</span> ymax, <span class="at">fill =</span> category, <span class="at">xmin =</span> <span class="sc">-</span><span class="cn">Inf</span>, <span class="at">xmax =</span> <span class="cn">Inf</span>),</span>
<span id="cb11-25"><a href="#cb11-25" aria-hidden="true" tabindex="-1"></a> <span class="at">alpha =</span> .<span class="dv">3</span>) <span class="sc">+</span></span>
<span id="cb11-26"><a href="#cb11-26" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">scale_fill_manual</span>(<span class="at">values=</span>vir) <span class="sc">+</span></span>
<span id="cb11-27"><a href="#cb11-27" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_point</span>(<span class="at">data=</span> mafmcsurvEPUcond, ggplot2<span class="sc">::</span><span class="fu">aes</span>(<span class="at">x=</span>Time, <span class="at">y=</span>scaleCond[,<span class="dv">1</span>])) <span class="sc">+</span></span>
<span id="cb11-28"><a href="#cb11-28" aria-hidden="true" tabindex="-1"></a> <span class="co">#ggplot2::geom_hline(yintercept = xs[2:5]) +</span></span>
<span id="cb11-29"><a href="#cb11-29" aria-hidden="true" tabindex="-1"></a> <span class="co">#ggplot2::geom_line() +</span></span>
<span id="cb11-30"><a href="#cb11-30" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">facet_grid</span>(Var<span class="sc">~</span><span class="fu">factor</span>(EPU, <span class="at">levels =</span> <span class="fu">c</span>(<span class="st">"MAB"</span>, <span class="st">"GB"</span>, <span class="st">"GOM"</span>, <span class="st">"SS"</span>, <span class="st">"NA"</span>)), ) <span class="sc">+</span></span>
<span id="cb11-31"><a href="#cb11-31" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">guides</span>(<span class="at">fill =</span> ggplot2<span class="sc">::</span><span class="fu">guide_legend</span>(<span class="at">reverse =</span> <span class="cn">TRUE</span>))</span>
<span id="cb11-32"><a href="#cb11-32" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb11-33"><a href="#cb11-33" aria-hidden="true" tabindex="-1"></a>p</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="RiskIndicators_files/figure-html/unnamed-chunk-7-1.png" class="img-fluid figure-img" width="960"></p>
</figure>
</div>
</div>
</div>
<p>Condition comparison?</p>
<p><code>ecodata::condition</code> missing EPU values</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb12"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a>ecodata<span class="sc">::</span>condition <span class="sc">|></span> dplyr<span class="sc">::</span><span class="fu">filter</span>(<span class="fu">is.na</span>(EPU)) <span class="sc">|></span> dplyr<span class="sc">::</span><span class="fu">select</span>(Var) <span class="sc">|></span> dplyr<span class="sc">::</span><span class="fu">distinct</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 14 × 1
Var
<chr>
1 Atlantic croaker
2 Blackbelly rosefish
3 Butterfish
4 Fourspot
5 Goosefish
6 Haddock
7 Offshore hake
8 Red hake
9 Rosette skate
10 Scup
11 Silver hake
12 Spot
13 Spotted hake
14 Weakfish </code></pre>
</div>
</div>
<p>Survey strata based EPU condition missing EPU values</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb14"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a>survEPUcond <span class="sc">|></span> dplyr<span class="sc">::</span><span class="fu">filter</span>(<span class="fu">is.na</span>(EPU)) <span class="sc">|></span> dplyr<span class="sc">::</span><span class="fu">select</span>(Var) <span class="sc">|></span> dplyr<span class="sc">::</span><span class="fu">distinct</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stderr">
<pre><code>Adding missing grouping variables: `EPU`</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 4 × 2
# Groups: EPU, Var [4]
EPU Var
<chr> <chr>
1 <NA> Atlantic croaker
2 <NA> Butterfish
3 <NA> Scup
4 <NA> Spotted hake </code></pre>
</div>
</div>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb17"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a>compfix <span class="ot"><-</span> fix <span class="sc">|></span></span>
<span id="cb17-2"><a href="#cb17-2" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">rename</span>(<span class="at">ecodataValue =</span> Value,</span>
<span id="cb17-3"><a href="#cb17-3" aria-hidden="true" tabindex="-1"></a> <span class="at">ecodataScaleCond =</span> scaleCond,</span>
<span id="cb17-4"><a href="#cb17-4" aria-hidden="true" tabindex="-1"></a> <span class="at">ecodataCategory =</span> category)</span>
<span id="cb17-5"><a href="#cb17-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb17-6"><a href="#cb17-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb17-7"><a href="#cb17-7" aria-hidden="true" tabindex="-1"></a>compcond <span class="ot"><-</span> survEPUcond <span class="sc">|></span></span>
<span id="cb17-8"><a href="#cb17-8" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">left_join</span>(compfix)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stderr">
<pre><code>Joining with `by = join_by(Time, Var, EPU)`</code></pre>
</div>
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb19"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a>p <span class="ot"><-</span> compcond <span class="sc">|></span></span>
<span id="cb19-2"><a href="#cb19-2" aria-hidden="true" tabindex="-1"></a>ggplot2<span class="sc">::</span><span class="fu">ggplot</span>(ggplot2<span class="sc">::</span><span class="fu">aes</span>(<span class="at">x=</span>scaleCond, <span class="at">y=</span>ecodataScaleCond), <span class="at">color=</span><span class="st">"blue"</span>) <span class="sc">+</span></span>
<span id="cb19-3"><a href="#cb19-3" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">theme_bw</span>() <span class="sc">+</span></span>
<span id="cb19-4"><a href="#cb19-4" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_point</span>() <span class="sc">+</span></span>
<span id="cb19-5"><a href="#cb19-5" aria-hidden="true" tabindex="-1"></a> <span class="co">#ggplot2::geom_smooth(data=bsbcondprey, ggplot2::aes(x=scaleMacro, y=scaleCond), method="lm", col="blue") +</span></span>
<span id="cb19-6"><a href="#cb19-6" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_abline</span>(<span class="at">intercept =</span> <span class="dv">0</span>, <span class="at">slope =</span> <span class="dv">1</span>, <span class="at">lty=</span><span class="dv">3</span>) <span class="sc">+</span></span>
<span id="cb19-7"><a href="#cb19-7" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_smooth</span>(<span class="at">method=</span>lm) <span class="sc">+</span></span>
<span id="cb19-8"><a href="#cb19-8" aria-hidden="true" tabindex="-1"></a> ggpubr<span class="sc">::</span><span class="fu">stat_cor</span>(<span class="at">method=</span><span class="st">"pearson"</span>, <span class="at">label.x =</span> <span class="dv">0</span>, <span class="at">label.y =</span> <span class="sc">-</span><span class="dv">2</span>) <span class="sc">+</span></span>
<span id="cb19-9"><a href="#cb19-9" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">facet_grid</span>(Var<span class="sc">~</span><span class="fu">factor</span>(EPU, <span class="at">levels =</span> <span class="fu">c</span>(<span class="st">"MAB"</span>, <span class="st">"GB"</span>, <span class="st">"GOM"</span>, <span class="st">"SS"</span>, <span class="st">"NA"</span>)))</span>
<span id="cb19-10"><a href="#cb19-10" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb19-11"><a href="#cb19-11" aria-hidden="true" tabindex="-1"></a>p</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stderr">
<pre><code>`geom_smooth()` using formula = 'y ~ x'</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Removed 179 rows containing non-finite outside the scale range
(`stat_smooth()`).</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Removed 179 rows containing non-finite outside the scale range
(`stat_cor()`).</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Removed 179 rows containing missing values or values outside the scale range
(`geom_point()`).</code></pre>
</div>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="RiskIndicators_files/figure-html/unnamed-chunk-10-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
</section>
<section id="prey-indicators" class="level2">
<h2 class="anchored" data-anchor-id="prey-indicators">Prey indicators</h2>
<p>Macrobenthos (fall)</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb24"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb24-1"><a href="#cb24-1" aria-hidden="true" tabindex="-1"></a>fallmacro <span class="ot"><-</span> <span class="fu">readRDS</span>(here<span class="sc">::</span><span class="fu">here</span>(<span class="st">"preyindices/fallmacrobenthosindex.rds"</span>))</span>
<span id="cb24-2"><a href="#cb24-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb24-3"><a href="#cb24-3" aria-hidden="true" tabindex="-1"></a>macroprey <span class="ot"><-</span> fallmacro <span class="sc">|></span></span>
<span id="cb24-4"><a href="#cb24-4" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">filter</span>(EPU <span class="sc">%in%</span> <span class="fu">c</span>(<span class="st">"MAB"</span>, <span class="st">"GB"</span>, <span class="st">"GOM"</span>),</span>
<span id="cb24-5"><a href="#cb24-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">str_detect</span>(Var, <span class="st">"Fall "</span>),</span>
<span id="cb24-6"><a href="#cb24-6" aria-hidden="true" tabindex="-1"></a> <span class="sc">!</span><span class="fu">str_detect</span>(Var, <span class="st">"SE"</span>)) </span>
<span id="cb24-7"><a href="#cb24-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb24-8"><a href="#cb24-8" aria-hidden="true" tabindex="-1"></a>ggplot2<span class="sc">::</span><span class="fu">ggplot</span>() <span class="sc">+</span></span>
<span id="cb24-9"><a href="#cb24-9" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">theme_bw</span>() <span class="sc">+</span></span>
<span id="cb24-10"><a href="#cb24-10" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_point</span>(<span class="at">data=</span>macroprey, ggplot2<span class="sc">::</span><span class="fu">aes</span>(<span class="at">x=</span>Time, <span class="at">y=</span>Value)) <span class="sc">+</span></span>
<span id="cb24-11"><a href="#cb24-11" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">facet_grid</span>(<span class="sc">~</span><span class="fu">factor</span>(EPU, <span class="at">levels =</span> <span class="fu">c</span>(<span class="st">"MAB"</span>, <span class="st">"GB"</span>, <span class="st">"GOM"</span>)))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="RiskIndicators_files/figure-html/unnamed-chunk-11-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
<p>Megabenthos (fall)</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb25"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb25-1"><a href="#cb25-1" aria-hidden="true" tabindex="-1"></a>fallmega <span class="ot"><-</span> <span class="fu">readRDS</span>(here<span class="sc">::</span><span class="fu">here</span>(<span class="st">"preyindices/fallmegabenthosindex.rds"</span>))</span>
<span id="cb25-2"><a href="#cb25-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb25-3"><a href="#cb25-3" aria-hidden="true" tabindex="-1"></a>megaprey <span class="ot"><-</span> fallmega <span class="sc">|></span></span>
<span id="cb25-4"><a href="#cb25-4" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">filter</span>(EPU <span class="sc">%in%</span> <span class="fu">c</span>(<span class="st">"MAB"</span>, <span class="st">"GB"</span>, <span class="st">"GOM"</span>),</span>
<span id="cb25-5"><a href="#cb25-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">str_detect</span>(Var, <span class="st">"Fall "</span>),</span>
<span id="cb25-6"><a href="#cb25-6" aria-hidden="true" tabindex="-1"></a> <span class="sc">!</span><span class="fu">str_detect</span>(Var, <span class="st">"SE"</span>)) </span>
<span id="cb25-7"><a href="#cb25-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb25-8"><a href="#cb25-8" aria-hidden="true" tabindex="-1"></a>ggplot2<span class="sc">::</span><span class="fu">ggplot</span>() <span class="sc">+</span></span>
<span id="cb25-9"><a href="#cb25-9" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">theme_bw</span>() <span class="sc">+</span></span>
<span id="cb25-10"><a href="#cb25-10" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_point</span>(<span class="at">data=</span>megaprey, ggplot2<span class="sc">::</span><span class="fu">aes</span>(<span class="at">x=</span>Time, <span class="at">y=</span>Value)) <span class="sc">+</span></span>
<span id="cb25-11"><a href="#cb25-11" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">facet_grid</span>(<span class="sc">~</span><span class="fu">factor</span>(EPU, <span class="at">levels =</span> <span class="fu">c</span>(<span class="st">"MAB"</span>, <span class="st">"GB"</span>, <span class="st">"GOM"</span>)))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="RiskIndicators_files/figure-html/unnamed-chunk-12-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
<p>Small copeopods (fall)</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb26"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb26-1"><a href="#cb26-1" aria-hidden="true" tabindex="-1"></a>fallsmcope <span class="ot"><-</span> <span class="fu">readRDS</span>(here<span class="sc">::</span><span class="fu">here</span>(<span class="st">"preyindices/fallsmcopepodALLindex.rds"</span>))</span>
<span id="cb26-2"><a href="#cb26-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb26-3"><a href="#cb26-3" aria-hidden="true" tabindex="-1"></a>smcopeprey <span class="ot"><-</span> fallsmcope <span class="sc">|></span></span>
<span id="cb26-4"><a href="#cb26-4" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">filter</span>(EPU <span class="sc">%in%</span> <span class="fu">c</span>(<span class="st">"MAB"</span>, <span class="st">"GB"</span>, <span class="st">"GOM"</span>),</span>
<span id="cb26-5"><a href="#cb26-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">str_detect</span>(Var, <span class="st">"Fall "</span>),</span>
<span id="cb26-6"><a href="#cb26-6" aria-hidden="true" tabindex="-1"></a> <span class="sc">!</span><span class="fu">str_detect</span>(Var, <span class="st">"SE"</span>))</span>
<span id="cb26-7"><a href="#cb26-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb26-8"><a href="#cb26-8" aria-hidden="true" tabindex="-1"></a>ggplot2<span class="sc">::</span><span class="fu">ggplot</span>() <span class="sc">+</span></span>
<span id="cb26-9"><a href="#cb26-9" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">theme_bw</span>() <span class="sc">+</span></span>
<span id="cb26-10"><a href="#cb26-10" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_point</span>(<span class="at">data=</span>smcopeprey, ggplot2<span class="sc">::</span><span class="fu">aes</span>(<span class="at">x=</span>Time, <span class="at">y=</span>Value)) <span class="sc">+</span></span>
<span id="cb26-11"><a href="#cb26-11" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">facet_grid</span>(<span class="sc">~</span><span class="fu">factor</span>(EPU, <span class="at">levels =</span> <span class="fu">c</span>(<span class="st">"MAB"</span>, <span class="st">"GB"</span>, <span class="st">"GOM"</span>)))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="RiskIndicators_files/figure-html/unnamed-chunk-13-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
<p>Forage fish (fall)</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb27"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb27-1"><a href="#cb27-1" aria-hidden="true" tabindex="-1"></a><span class="co">#ecodata::plot_forage_index(report = "MidAtlantic")</span></span>
<span id="cb27-2"><a href="#cb27-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb27-3"><a href="#cb27-3" aria-hidden="true" tabindex="-1"></a><span class="co">#ecodata::plot_forage_index(report = "NewEngland")</span></span>
<span id="cb27-4"><a href="#cb27-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb27-5"><a href="#cb27-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb27-6"><a href="#cb27-6" aria-hidden="true" tabindex="-1"></a>foragefishprey <span class="ot"><-</span> ecodata<span class="sc">::</span>forage_index <span class="sc">|></span></span>
<span id="cb27-7"><a href="#cb27-7" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">filter</span>(EPU <span class="sc">%in%</span> <span class="fu">c</span>(<span class="st">"MAB"</span>, <span class="st">"GB"</span>, <span class="st">"GOM"</span>),</span>
<span id="cb27-8"><a href="#cb27-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">str_detect</span>(Var, <span class="st">"Fall "</span>),</span>
<span id="cb27-9"><a href="#cb27-9" aria-hidden="true" tabindex="-1"></a> <span class="sc">!</span><span class="fu">str_detect</span>(Var, <span class="st">"SE"</span>)) </span>
<span id="cb27-10"><a href="#cb27-10" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb27-11"><a href="#cb27-11" aria-hidden="true" tabindex="-1"></a>ggplot2<span class="sc">::</span><span class="fu">ggplot</span>() <span class="sc">+</span></span>
<span id="cb27-12"><a href="#cb27-12" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">theme_bw</span>() <span class="sc">+</span></span>
<span id="cb27-13"><a href="#cb27-13" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_point</span>(<span class="at">data=</span>foragefishprey, ggplot2<span class="sc">::</span><span class="fu">aes</span>(<span class="at">x=</span>Time, <span class="at">y=</span>Value)) <span class="sc">+</span></span>
<span id="cb27-14"><a href="#cb27-14" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">facet_grid</span>(<span class="sc">~</span><span class="fu">factor</span>(EPU, <span class="at">levels =</span> <span class="fu">c</span>(<span class="st">"MAB"</span>, <span class="st">"GB"</span>, <span class="st">"GOM"</span>)))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="RiskIndicators_files/figure-html/unnamed-chunk-14-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
</section>
<section id="combine-condition-and-prey-index-indicators" class="level2">
<h2 class="anchored" data-anchor-id="combine-condition-and-prey-index-indicators">Combine condition and prey index indicators</h2>
<p>Are predator condition time series correlated with major prey?</p>
<p>Highest risk might be significant decreasing prey correlated with decrease in or current poor condition?</p>
<p>Lets look at a benthivore, a planktivore, and a piscivore as examples.</p>
<section id="black-sea-bass" class="level3">
<h3 class="anchored" data-anchor-id="black-sea-bass">Black sea bass</h3>
<p>Macrobenthos correlated with condition? Yes in the Mid. Both are declining recently. Not significant in GOM.</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb28"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb28-1"><a href="#cb28-1" aria-hidden="true" tabindex="-1"></a>macrojoin <span class="ot"><-</span> macroprey <span class="sc">|></span></span>
<span id="cb28-2"><a href="#cb28-2" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">select</span>(Time, <span class="at">FallMacroB =</span> Value, EPU)</span>
<span id="cb28-3"><a href="#cb28-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb28-4"><a href="#cb28-4" aria-hidden="true" tabindex="-1"></a>megajoin <span class="ot"><-</span> megaprey <span class="sc">|></span></span>
<span id="cb28-5"><a href="#cb28-5" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">select</span>(Time, <span class="at">FallMegaB =</span> Value, EPU)</span>
<span id="cb28-6"><a href="#cb28-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb28-7"><a href="#cb28-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb28-8"><a href="#cb28-8" aria-hidden="true" tabindex="-1"></a>bsbcondprey <span class="ot"><-</span> mafmccondall <span class="sc">|></span></span>
<span id="cb28-9"><a href="#cb28-9" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">filter</span>(Var <span class="sc">==</span> <span class="st">"Black sea bass"</span>) <span class="sc">|></span></span>
<span id="cb28-10"><a href="#cb28-10" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">left_join</span>(macrojoin) <span class="sc">|></span></span>
<span id="cb28-11"><a href="#cb28-11" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">left_join</span>(megajoin) <span class="sc">|></span></span>
<span id="cb28-12"><a href="#cb28-12" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">scaleMacro =</span> <span class="fu">scale</span>(FallMacroB,<span class="at">scale =</span>T,<span class="at">center=</span>T),</span>
<span id="cb28-13"><a href="#cb28-13" aria-hidden="true" tabindex="-1"></a> <span class="at">scaleMega =</span> <span class="fu">scale</span>(FallMegaB,<span class="at">scale =</span>T,<span class="at">center=</span>T))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stderr">
<pre><code>Joining with `by = join_by(Time, EPU)`
Joining with `by = join_by(Time, EPU)`</code></pre>
</div>
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb30"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb30-1"><a href="#cb30-1" aria-hidden="true" tabindex="-1"></a>ggplot2<span class="sc">::</span><span class="fu">ggplot</span>(<span class="at">data=</span>bsbcondprey, ggplot2<span class="sc">::</span><span class="fu">aes</span>(<span class="at">x=</span>scaleMacro, <span class="at">y=</span>scaleCond), <span class="at">color=</span><span class="st">"blue"</span>) <span class="sc">+</span></span>
<span id="cb30-2"><a href="#cb30-2" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">theme_bw</span>() <span class="sc">+</span></span>
<span id="cb30-3"><a href="#cb30-3" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_point</span>() <span class="sc">+</span></span>
<span id="cb30-4"><a href="#cb30-4" aria-hidden="true" tabindex="-1"></a> <span class="co">#ggplot2::geom_smooth(data=bsbcondprey, ggplot2::aes(x=scaleMacro, y=scaleCond), method="lm", col="blue") +</span></span>
<span id="cb30-5"><a href="#cb30-5" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_abline</span>(<span class="at">intercept =</span> <span class="dv">0</span>, <span class="at">slope =</span> <span class="dv">1</span>, <span class="at">lty=</span><span class="dv">3</span>) <span class="sc">+</span></span>
<span id="cb30-6"><a href="#cb30-6" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_smooth</span>(<span class="at">method=</span>lm) <span class="sc">+</span></span>
<span id="cb30-7"><a href="#cb30-7" aria-hidden="true" tabindex="-1"></a> ggpubr<span class="sc">::</span><span class="fu">stat_cor</span>(<span class="at">method=</span><span class="st">"pearson"</span>, <span class="at">label.x =</span> <span class="dv">0</span>, <span class="at">label.y =</span> <span class="sc">-</span><span class="dv">2</span>) <span class="sc">+</span></span>
<span id="cb30-8"><a href="#cb30-8" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">facet_grid</span>(<span class="sc">~</span><span class="fu">factor</span>(EPU, <span class="at">levels =</span> <span class="fu">c</span>(<span class="st">"MAB"</span>, <span class="st">"GB"</span>, <span class="st">"GOM"</span>)))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stderr">
<pre><code>`geom_smooth()` using formula = 'y ~ x'</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Removed 2 rows containing non-finite outside the scale range
(`stat_smooth()`).</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Removed 2 rows containing non-finite outside the scale range
(`stat_cor()`).</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Removed 2 rows containing missing values or values outside the scale range
(`geom_point()`).</code></pre>
</div>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="RiskIndicators_files/figure-html/unnamed-chunk-15-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
<p>Megabenthos correlated with condition? No, these are not significantly correlated.</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb35"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb35-1"><a href="#cb35-1" aria-hidden="true" tabindex="-1"></a>ggplot2<span class="sc">::</span><span class="fu">ggplot</span>(<span class="at">data=</span>bsbcondprey, ggplot2<span class="sc">::</span><span class="fu">aes</span>(<span class="at">x=</span>scaleMega, <span class="at">y=</span>scaleCond), <span class="at">color=</span><span class="st">"red"</span>) <span class="sc">+</span></span>
<span id="cb35-2"><a href="#cb35-2" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">theme_bw</span>() <span class="sc">+</span></span>
<span id="cb35-3"><a href="#cb35-3" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_point</span>() <span class="sc">+</span></span>
<span id="cb35-4"><a href="#cb35-4" aria-hidden="true" tabindex="-1"></a> <span class="co">#ggplot2::geom_smooth(data=bsbcondprey, ggplot2::aes(x=scaleMega, y=scaleCond), method="lm", col="red") +</span></span>
<span id="cb35-5"><a href="#cb35-5" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_abline</span>(<span class="at">intercept =</span> <span class="dv">0</span>, <span class="at">slope =</span> <span class="dv">1</span>, <span class="at">lty=</span><span class="dv">3</span>) <span class="sc">+</span></span>
<span id="cb35-6"><a href="#cb35-6" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_smooth</span>(<span class="at">method=</span>lm) <span class="sc">+</span></span>
<span id="cb35-7"><a href="#cb35-7" aria-hidden="true" tabindex="-1"></a> ggpubr<span class="sc">::</span><span class="fu">stat_cor</span>(<span class="at">method=</span><span class="st">"pearson"</span>, <span class="at">label.x =</span> <span class="dv">0</span>, <span class="at">label.y =</span> <span class="sc">-</span><span class="dv">2</span>) <span class="sc">+</span></span>
<span id="cb35-8"><a href="#cb35-8" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">facet_grid</span>(<span class="sc">~</span><span class="fu">factor</span>(EPU, <span class="at">levels =</span> <span class="fu">c</span>(<span class="st">"MAB"</span>, <span class="st">"GB"</span>, <span class="st">"GOM"</span>)))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stderr">
<pre><code>`geom_smooth()` using formula = 'y ~ x'</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Removed 2 rows containing non-finite outside the scale range
(`stat_smooth()`).</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Removed 2 rows containing non-finite outside the scale range
(`stat_cor()`).</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Removed 2 rows containing missing values or values outside the scale range
(`geom_point()`).</code></pre>
</div>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="RiskIndicators_files/figure-html/unnamed-chunk-16-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
<p>Black sea bass condition and macrobenthos in MAB as time series:</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb40"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb40-1"><a href="#cb40-1" aria-hidden="true" tabindex="-1"></a>ggplot2<span class="sc">::</span><span class="fu">ggplot</span>(<span class="at">data=</span>bsbcondprey, ggplot2<span class="sc">::</span><span class="fu">aes</span>(<span class="at">x=</span>Time, <span class="at">y=</span>scaleCond)) <span class="sc">+</span></span>
<span id="cb40-2"><a href="#cb40-2" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">theme_bw</span>() <span class="sc">+</span></span>
<span id="cb40-3"><a href="#cb40-3" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_point</span>() <span class="sc">+</span></span>
<span id="cb40-4"><a href="#cb40-4" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_line</span>() <span class="sc">+</span></span>
<span id="cb40-5"><a href="#cb40-5" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_point</span>(<span class="at">data=</span>bsbcondprey, ggplot2<span class="sc">::</span><span class="fu">aes</span>(<span class="at">x=</span>Time, <span class="at">y=</span>scaleMacro), <span class="at">col=</span><span class="st">"blue"</span>) <span class="sc">+</span></span>
<span id="cb40-6"><a href="#cb40-6" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_line</span>(<span class="at">data=</span>bsbcondprey, ggplot2<span class="sc">::</span><span class="fu">aes</span>(<span class="at">x=</span>Time, <span class="at">y=</span>scaleMacro), <span class="at">col=</span><span class="st">"blue"</span>) <span class="sc">+</span></span>
<span id="cb40-7"><a href="#cb40-7" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">facet_grid</span>(<span class="sc">~</span><span class="fu">factor</span>(EPU, <span class="at">levels =</span> <span class="fu">c</span>(<span class="st">"MAB"</span>, <span class="st">"GB"</span>, <span class="st">"GOM"</span>)))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Removed 2 rows containing missing values or values outside the scale range
(`geom_point()`).</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Removed 1 row containing missing values or values outside the scale range
(`geom_line()`).</code></pre>
</div>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="RiskIndicators_files/figure-html/unnamed-chunk-17-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb43"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb43-1"><a href="#cb43-1" aria-hidden="true" tabindex="-1"></a>bsbcondall <span class="ot"><-</span> fix <span class="sc">|></span></span>
<span id="cb43-2"><a href="#cb43-2" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">filter</span>(Var <span class="sc">%in%</span> <span class="fu">c</span>(<span class="st">"Black sea bass"</span>),</span>
<span id="cb43-3"><a href="#cb43-3" aria-hidden="true" tabindex="-1"></a> EPU <span class="sc">%in%</span> <span class="fu">c</span>(<span class="st">"MAB"</span>)) </span>
<span id="cb43-4"><a href="#cb43-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb43-5"><a href="#cb43-5" aria-hidden="true" tabindex="-1"></a>p <span class="ot"><-</span> ggplot2<span class="sc">::</span><span class="fu">ggplot</span>() <span class="sc">+</span></span>
<span id="cb43-6"><a href="#cb43-6" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">theme_bw</span>() <span class="sc">+</span></span>
<span id="cb43-7"><a href="#cb43-7" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_rect</span>(<span class="at">data =</span> condquants,</span>
<span id="cb43-8"><a href="#cb43-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">aes</span>(<span class="at">ymin =</span> ymin, <span class="at">ymax =</span> ymax, <span class="at">fill =</span> category, <span class="at">xmin =</span> <span class="sc">-</span><span class="cn">Inf</span>, <span class="at">xmax =</span> <span class="cn">Inf</span>),</span>
<span id="cb43-9"><a href="#cb43-9" aria-hidden="true" tabindex="-1"></a> <span class="at">alpha =</span> .<span class="dv">3</span>) <span class="sc">+</span></span>
<span id="cb43-10"><a href="#cb43-10" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">scale_fill_manual</span>(<span class="at">values=</span>vir) <span class="sc">+</span></span>
<span id="cb43-11"><a href="#cb43-11" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_point</span>(<span class="at">data=</span> bsbcondall, ggplot2<span class="sc">::</span><span class="fu">aes</span>(<span class="at">x=</span>Time, <span class="at">y=</span>scaleCond[,<span class="dv">1</span>])) <span class="sc">+</span></span>
<span id="cb43-12"><a href="#cb43-12" aria-hidden="true" tabindex="-1"></a> <span class="co">#ggplot2::geom_hline(yintercept = xs[2:5]) +</span></span>
<span id="cb43-13"><a href="#cb43-13" aria-hidden="true" tabindex="-1"></a> <span class="co">#ggplot2::geom_line() +</span></span>
<span id="cb43-14"><a href="#cb43-14" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">facet_grid</span>(Var<span class="sc">~</span><span class="fu">factor</span>(EPU, <span class="at">levels =</span> <span class="fu">c</span>(<span class="st">"MAB"</span>, <span class="st">"GB"</span>, <span class="st">"GOM"</span>, <span class="st">"SS"</span>, <span class="st">"NA"</span>)), ) <span class="sc">+</span></span>
<span id="cb43-15"><a href="#cb43-15" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">ylab</span>(<span class="st">"Scaled condition"</span>) <span class="sc">+</span></span>
<span id="cb43-16"><a href="#cb43-16" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">ggtitle</span>(<span class="st">"Black sea bass"</span>) <span class="sc">+</span></span>
<span id="cb43-17"><a href="#cb43-17" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">guides</span>(<span class="at">fill =</span> ggplot2<span class="sc">::</span><span class="fu">guide_legend</span>(<span class="at">reverse =</span> <span class="cn">TRUE</span>))</span>
<span id="cb43-18"><a href="#cb43-18" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb43-19"><a href="#cb43-19" aria-hidden="true" tabindex="-1"></a>p</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="RiskIndicators_files/figure-html/unnamed-chunk-18-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb44"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb44-1"><a href="#cb44-1" aria-hidden="true" tabindex="-1"></a>fallmacro <span class="ot"><-</span> <span class="fu">readRDS</span>(here<span class="sc">::</span><span class="fu">here</span>(<span class="st">"preyindices/fallmacrobenthosindex.rds"</span>))</span>
<span id="cb44-2"><a href="#cb44-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb44-3"><a href="#cb44-3" aria-hidden="true" tabindex="-1"></a>fixmacro<span class="ot"><-</span> fallmacro <span class="sc">|></span></span>
<span id="cb44-4"><a href="#cb44-4" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">filter</span>(Var <span class="sc">%in%</span> <span class="fu">c</span>(<span class="st">"Fall Macrobenthos Biomass Index Estimate"</span>),</span>
<span id="cb44-5"><a href="#cb44-5" aria-hidden="true" tabindex="-1"></a> EPU <span class="sc">%in%</span> <span class="fu">c</span>(<span class="st">"MAB"</span>)) <span class="sc">|></span></span>
<span id="cb44-6"><a href="#cb44-6" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">group_by</span>(EPU) <span class="sc">|></span></span>
<span id="cb44-7"><a href="#cb44-7" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">summarise</span>(<span class="at">max =</span> <span class="fu">max</span>(Value))</span>
<span id="cb44-8"><a href="#cb44-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb44-9"><a href="#cb44-9" aria-hidden="true" tabindex="-1"></a> p <span class="ot"><-</span> fallmacro <span class="sc">|></span></span>
<span id="cb44-10"><a href="#cb44-10" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">filter</span>(Var <span class="sc">%in%</span> <span class="fu">c</span>(<span class="st">"Fall Macrobenthos Biomass Index Estimate"</span>,</span>
<span id="cb44-11"><a href="#cb44-11" aria-hidden="true" tabindex="-1"></a> <span class="st">"Fall Macrobenthos Biomass Index Estimate SE"</span>),</span>
<span id="cb44-12"><a href="#cb44-12" aria-hidden="true" tabindex="-1"></a> EPU <span class="sc">%in%</span> <span class="fu">c</span>(<span class="st">"MAB"</span>)) <span class="sc">|></span></span>
<span id="cb44-13"><a href="#cb44-13" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">group_by</span>(EPU) <span class="sc">|></span></span>
<span id="cb44-14"><a href="#cb44-14" aria-hidden="true" tabindex="-1"></a> tidyr<span class="sc">::</span><span class="fu">separate</span>(Var, <span class="at">into =</span> <span class="fu">c</span>(<span class="st">"Season"</span>, <span class="st">"A"</span>, <span class="st">"B"</span>, <span class="st">"C"</span>, <span class="st">"D"</span>, <span class="st">"Var"</span>)) <span class="sc">|></span></span>
<span id="cb44-15"><a href="#cb44-15" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">Var =</span> tidyr<span class="sc">::</span><span class="fu">replace_na</span>(Var, <span class="st">"Mean"</span>)) <span class="sc">|></span> <span class="co">#,</span></span>
<span id="cb44-16"><a href="#cb44-16" aria-hidden="true" tabindex="-1"></a> <span class="co">#max = as.numeric(Value)) |></span></span>
<span id="cb44-17"><a href="#cb44-17" aria-hidden="true" tabindex="-1"></a> tidyr<span class="sc">::</span><span class="fu">pivot_wider</span>(<span class="at">names_from =</span> Var, <span class="at">values_from =</span> Value) <span class="sc">|></span></span>
<span id="cb44-18"><a href="#cb44-18" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">left_join</span>(fixmacro) <span class="sc">|></span></span>
<span id="cb44-19"><a href="#cb44-19" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="co">#Value = Value/resca,</span></span>
<span id="cb44-20"><a href="#cb44-20" aria-hidden="true" tabindex="-1"></a> <span class="at">Mean =</span> <span class="fu">as.numeric</span>(Mean),</span>
<span id="cb44-21"><a href="#cb44-21" aria-hidden="true" tabindex="-1"></a> <span class="co">#max = as.numeric(Value),</span></span>
<span id="cb44-22"><a href="#cb44-22" aria-hidden="true" tabindex="-1"></a> <span class="at">Mean =</span> Mean<span class="sc">/</span>max,</span>
<span id="cb44-23"><a href="#cb44-23" aria-hidden="true" tabindex="-1"></a> <span class="at">SE =</span> SE<span class="sc">/</span>max,</span>
<span id="cb44-24"><a href="#cb44-24" aria-hidden="true" tabindex="-1"></a> <span class="at">Upper =</span> Mean <span class="sc">+</span> SE,</span>
<span id="cb44-25"><a href="#cb44-25" aria-hidden="true" tabindex="-1"></a> <span class="at">Lower =</span> Mean <span class="sc">-</span> SE) <span class="sc">|></span></span>
<span id="cb44-26"><a href="#cb44-26" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">ggplot</span>(ggplot2<span class="sc">::</span><span class="fu">aes</span>(<span class="at">x =</span> Time, <span class="at">y =</span> Mean, <span class="at">group =</span> Season))<span class="sc">+</span></span>
<span id="cb44-27"><a href="#cb44-27" aria-hidden="true" tabindex="-1"></a> <span class="co">#ggplot2::annotate("rect", fill = setup$shade.fill, alpha = setup$shade.alpha,</span></span>
<span id="cb44-28"><a href="#cb44-28" aria-hidden="true" tabindex="-1"></a> <span class="co"># xmin = setup$x.shade.min , xmax = setup$x.shade.max,</span></span>
<span id="cb44-29"><a href="#cb44-29" aria-hidden="true" tabindex="-1"></a> <span class="co"># ymin = -Inf, ymax = Inf) +</span></span>
<span id="cb44-30"><a href="#cb44-30" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_ribbon</span>(ggplot2<span class="sc">::</span><span class="fu">aes</span>(<span class="at">ymin =</span> Lower, <span class="at">ymax =</span> Upper, <span class="at">fill =</span> Season), <span class="at">alpha =</span> <span class="fl">0.5</span>)<span class="sc">+</span></span>
<span id="cb44-31"><a href="#cb44-31" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_point</span>()<span class="sc">+</span></span>
<span id="cb44-32"><a href="#cb44-32" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_line</span>()<span class="sc">+</span></span>
<span id="cb44-33"><a href="#cb44-33" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">ggtitle</span>(<span class="st">"Macrofauna prey"</span>)<span class="sc">+</span></span>
<span id="cb44-34"><a href="#cb44-34" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">ylab</span>(<span class="fu">expression</span>(<span class="st">"Relative macrofauna biomass"</span>))<span class="sc">+</span></span>
<span id="cb44-35"><a href="#cb44-35" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">xlab</span>(ggplot2<span class="sc">::</span><span class="fu">element_blank</span>())<span class="sc">+</span></span>
<span id="cb44-36"><a href="#cb44-36" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">facet_wrap</span>(.<span class="sc">~</span>EPU)<span class="sc">+</span></span>
<span id="cb44-37"><a href="#cb44-37" aria-hidden="true" tabindex="-1"></a> ecodata<span class="sc">::</span><span class="fu">geom_gls</span>()<span class="sc">+</span></span>
<span id="cb44-38"><a href="#cb44-38" aria-hidden="true" tabindex="-1"></a> ecodata<span class="sc">::</span><span class="fu">theme_ts</span>()<span class="sc">+</span></span>
<span id="cb44-39"><a href="#cb44-39" aria-hidden="true" tabindex="-1"></a> ecodata<span class="sc">::</span><span class="fu">theme_facet</span>()<span class="sc">+</span></span>
<span id="cb44-40"><a href="#cb44-40" aria-hidden="true" tabindex="-1"></a> ecodata<span class="sc">::</span><span class="fu">theme_title</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Expected 6 pieces. Missing pieces filled with `NA` in 43 rows [1, 3, 5, 7, 9,
11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, ...].</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Joining with `by = join_by(EPU)`</code></pre>
</div>
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb47"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb47-1"><a href="#cb47-1" aria-hidden="true" tabindex="-1"></a> p </span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="RiskIndicators_files/figure-html/unnamed-chunk-19-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
<p>What if we summed macrobenthos and megabenthos by EPU (indices are theoretically on the same scale of g/stomach). This would now account for the majority of BSB diet, ~75%. Doing this just weakens the correlation with macrobenthos alone.</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb48"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb48-1"><a href="#cb48-1" aria-hidden="true" tabindex="-1"></a>p <span class="ot"><-</span> bsbcondprey <span class="sc">|></span></span>
<span id="cb48-2"><a href="#cb48-2" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">FallTotBen =</span> FallMacroB <span class="sc">+</span> FallMegaB,</span>
<span id="cb48-3"><a href="#cb48-3" aria-hidden="true" tabindex="-1"></a> <span class="at">scaleTotBen =</span> <span class="fu">scale</span>(FallTotBen,<span class="at">scale =</span>T,<span class="at">center=</span>T)) <span class="sc">|></span></span>
<span id="cb48-4"><a href="#cb48-4" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">ggplot</span>(ggplot2<span class="sc">::</span><span class="fu">aes</span>(<span class="at">x=</span>scaleTotBen, <span class="at">y=</span>scaleCond), <span class="at">color=</span><span class="st">"blue"</span>) <span class="sc">+</span></span>
<span id="cb48-5"><a href="#cb48-5" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">theme_bw</span>() <span class="sc">+</span></span>
<span id="cb48-6"><a href="#cb48-6" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_point</span>() <span class="sc">+</span></span>
<span id="cb48-7"><a href="#cb48-7" aria-hidden="true" tabindex="-1"></a> <span class="co">#ggplot2::geom_smooth(data=bsbcondprey, ggplot2::aes(x=scaleMacro, y=scaleCond), method="lm", col="blue") +</span></span>
<span id="cb48-8"><a href="#cb48-8" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_abline</span>(<span class="at">intercept =</span> <span class="dv">0</span>, <span class="at">slope =</span> <span class="dv">1</span>, <span class="at">lty=</span><span class="dv">3</span>) <span class="sc">+</span></span>
<span id="cb48-9"><a href="#cb48-9" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_smooth</span>(<span class="at">method=</span>lm) <span class="sc">+</span></span>
<span id="cb48-10"><a href="#cb48-10" aria-hidden="true" tabindex="-1"></a> ggpubr<span class="sc">::</span><span class="fu">stat_cor</span>(<span class="at">method=</span><span class="st">"pearson"</span>, <span class="at">label.x =</span> <span class="dv">0</span>, <span class="at">label.y =</span> <span class="sc">-</span><span class="dv">2</span>) <span class="sc">+</span></span>
<span id="cb48-11"><a href="#cb48-11" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">facet_grid</span>(<span class="sc">~</span><span class="fu">factor</span>(EPU, <span class="at">levels =</span> <span class="fu">c</span>(<span class="st">"MAB"</span>, <span class="st">"GB"</span>, <span class="st">"GOM"</span>)))</span>
<span id="cb48-12"><a href="#cb48-12" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb48-13"><a href="#cb48-13" aria-hidden="true" tabindex="-1"></a>p </span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stderr">
<pre><code>`geom_smooth()` using formula = 'y ~ x'</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Removed 2 rows containing non-finite outside the scale range
(`stat_smooth()`).</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Removed 2 rows containing non-finite outside the scale range
(`stat_cor()`).</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Removed 2 rows containing missing values or values outside the scale range
(`geom_point()`).</code></pre>
</div>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="RiskIndicators_files/figure-html/unnamed-chunk-20-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
<p>What about a zooplankton eater?</p>
</section>
<section id="atlantic-mackerel" class="level3">
<h3 class="anchored" data-anchor-id="atlantic-mackerel">Atlantic mackerel</h3>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb53"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb53-1"><a href="#cb53-1" aria-hidden="true" tabindex="-1"></a>smcopejoin <span class="ot"><-</span> smcopeprey <span class="sc">|></span></span>
<span id="cb53-2"><a href="#cb53-2" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">select</span>(Time, <span class="at">FallSmCopeN =</span> Value, EPU)</span>
<span id="cb53-3"><a href="#cb53-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb53-4"><a href="#cb53-4" aria-hidden="true" tabindex="-1"></a>mackcondprey <span class="ot"><-</span> mafmccondall <span class="sc">|></span></span>
<span id="cb53-5"><a href="#cb53-5" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">filter</span>(Var <span class="sc">==</span> <span class="st">"Atlantic mackerel"</span>,</span>
<span id="cb53-6"><a href="#cb53-6" aria-hidden="true" tabindex="-1"></a> <span class="sc">!</span><span class="fu">is.na</span>(EPU)) <span class="sc">|></span></span>
<span id="cb53-7"><a href="#cb53-7" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">left_join</span>(macrojoin) <span class="sc">|></span></span>
<span id="cb53-8"><a href="#cb53-8" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">left_join</span>(smcopejoin) <span class="sc">|></span></span>
<span id="cb53-9"><a href="#cb53-9" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">mutate</span>(<span class="at">scaleMacro =</span> <span class="fu">scale</span>(FallMacroB,<span class="at">scale =</span>T,<span class="at">center=</span>T),</span>
<span id="cb53-10"><a href="#cb53-10" aria-hidden="true" tabindex="-1"></a> <span class="at">scaleSmCope =</span> <span class="fu">scale</span>(FallSmCopeN,<span class="at">scale =</span>T,<span class="at">center=</span>T))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stderr">
<pre><code>Joining with `by = join_by(Time, EPU)`
Joining with `by = join_by(Time, EPU)`</code></pre>
</div>
</div>
<p>Condition has been Above average (3), good or neutral (1 each) for the past 5 observations (MAB)</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb55"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb55-1"><a href="#cb55-1" aria-hidden="true" tabindex="-1"></a>mackcondmab <span class="ot"><-</span> fix <span class="sc">|></span></span>
<span id="cb55-2"><a href="#cb55-2" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">filter</span>(Var <span class="sc">%in%</span> <span class="fu">c</span>(<span class="st">"Atlantic mackerel"</span>),</span>
<span id="cb55-3"><a href="#cb55-3" aria-hidden="true" tabindex="-1"></a> EPU <span class="sc">%in%</span> <span class="fu">c</span>(<span class="st">"MAB"</span>)) </span>
<span id="cb55-4"><a href="#cb55-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb55-5"><a href="#cb55-5" aria-hidden="true" tabindex="-1"></a>mackcondall <span class="ot"><-</span> fix <span class="sc">|></span></span>
<span id="cb55-6"><a href="#cb55-6" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">filter</span>(Var <span class="sc">%in%</span> <span class="fu">c</span>(<span class="st">"Atlantic mackerel"</span>)) </span>
<span id="cb55-7"><a href="#cb55-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb55-8"><a href="#cb55-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb55-9"><a href="#cb55-9" aria-hidden="true" tabindex="-1"></a>p <span class="ot"><-</span> ggplot2<span class="sc">::</span><span class="fu">ggplot</span>() <span class="sc">+</span></span>
<span id="cb55-10"><a href="#cb55-10" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">theme_bw</span>() <span class="sc">+</span></span>
<span id="cb55-11"><a href="#cb55-11" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_rect</span>(<span class="at">data =</span> condquants,</span>
<span id="cb55-12"><a href="#cb55-12" aria-hidden="true" tabindex="-1"></a> <span class="fu">aes</span>(<span class="at">ymin =</span> ymin, <span class="at">ymax =</span> ymax, <span class="at">fill =</span> category, <span class="at">xmin =</span> <span class="sc">-</span><span class="cn">Inf</span>, <span class="at">xmax =</span> <span class="cn">Inf</span>),</span>
<span id="cb55-13"><a href="#cb55-13" aria-hidden="true" tabindex="-1"></a> <span class="at">alpha =</span> .<span class="dv">3</span>) <span class="sc">+</span></span>
<span id="cb55-14"><a href="#cb55-14" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">scale_fill_manual</span>(<span class="at">values=</span>vir) <span class="sc">+</span></span>
<span id="cb55-15"><a href="#cb55-15" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_point</span>(<span class="at">data=</span> mackcondmab, ggplot2<span class="sc">::</span><span class="fu">aes</span>(<span class="at">x=</span>Time, <span class="at">y=</span>scaleCond[,<span class="dv">1</span>])) <span class="sc">+</span></span>
<span id="cb55-16"><a href="#cb55-16" aria-hidden="true" tabindex="-1"></a> <span class="co">#ggplot2::geom_hline(yintercept = xs[2:5]) +</span></span>
<span id="cb55-17"><a href="#cb55-17" aria-hidden="true" tabindex="-1"></a> <span class="co">#ggplot2::geom_line() +</span></span>
<span id="cb55-18"><a href="#cb55-18" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">facet_grid</span>(Var<span class="sc">~</span><span class="fu">factor</span>(EPU, <span class="at">levels =</span> <span class="fu">c</span>(<span class="st">"MAB"</span>, <span class="st">"GB"</span>, <span class="st">"GOM"</span>, <span class="st">"SS"</span>, <span class="st">"NA"</span>)), ) <span class="sc">+</span></span>
<span id="cb55-19"><a href="#cb55-19" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">ylab</span>(<span class="st">"Scaled condition"</span>) <span class="sc">+</span></span>
<span id="cb55-20"><a href="#cb55-20" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">ggtitle</span>(<span class="st">"Atlantic mackerel"</span>) <span class="sc">+</span></span>
<span id="cb55-21"><a href="#cb55-21" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">guides</span>(<span class="at">fill =</span> ggplot2<span class="sc">::</span><span class="fu">guide_legend</span>(<span class="at">reverse =</span> <span class="cn">TRUE</span>))</span>
<span id="cb55-22"><a href="#cb55-22" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb55-23"><a href="#cb55-23" aria-hidden="true" tabindex="-1"></a>p</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="RiskIndicators_files/figure-html/unnamed-chunk-22-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
<p>Recent condition differs across regions? Yes, GB has similar status to MAB, but GOM has below average, or poor for the most recent 5 observations.</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb56"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb56-1"><a href="#cb56-1" aria-hidden="true" tabindex="-1"></a>p <span class="ot"><-</span> ggplot2<span class="sc">::</span><span class="fu">ggplot</span>() <span class="sc">+</span></span>
<span id="cb56-2"><a href="#cb56-2" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">theme_bw</span>() <span class="sc">+</span></span>
<span id="cb56-3"><a href="#cb56-3" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_rect</span>(<span class="at">data =</span> condquants,</span>
<span id="cb56-4"><a href="#cb56-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">aes</span>(<span class="at">ymin =</span> ymin, <span class="at">ymax =</span> ymax, <span class="at">fill =</span> category, <span class="at">xmin =</span> <span class="sc">-</span><span class="cn">Inf</span>, <span class="at">xmax =</span> <span class="cn">Inf</span>),</span>
<span id="cb56-5"><a href="#cb56-5" aria-hidden="true" tabindex="-1"></a> <span class="at">alpha =</span> .<span class="dv">3</span>) <span class="sc">+</span></span>
<span id="cb56-6"><a href="#cb56-6" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">scale_fill_manual</span>(<span class="at">values=</span>vir) <span class="sc">+</span></span>
<span id="cb56-7"><a href="#cb56-7" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_point</span>(<span class="at">data=</span> mackcondall, ggplot2<span class="sc">::</span><span class="fu">aes</span>(<span class="at">x=</span>Time, <span class="at">y=</span>scaleCond[,<span class="dv">1</span>])) <span class="sc">+</span></span>
<span id="cb56-8"><a href="#cb56-8" aria-hidden="true" tabindex="-1"></a> <span class="co">#ggplot2::geom_hline(yintercept = xs[2:5]) +</span></span>
<span id="cb56-9"><a href="#cb56-9" aria-hidden="true" tabindex="-1"></a> <span class="co">#ggplot2::geom_line() +</span></span>
<span id="cb56-10"><a href="#cb56-10" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">facet_grid</span>(Var<span class="sc">~</span><span class="fu">factor</span>(EPU, <span class="at">levels =</span> <span class="fu">c</span>(<span class="st">"MAB"</span>, <span class="st">"GB"</span>, <span class="st">"GOM"</span>, <span class="st">"SS"</span>, <span class="st">"NA"</span>)), ) <span class="sc">+</span></span>
<span id="cb56-11"><a href="#cb56-11" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">ylab</span>(<span class="st">"Scaled condition"</span>) <span class="sc">+</span></span>
<span id="cb56-12"><a href="#cb56-12" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">ggtitle</span>(<span class="st">"Atlantic mackerel"</span>) <span class="sc">+</span></span>
<span id="cb56-13"><a href="#cb56-13" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">guides</span>(<span class="at">fill =</span> ggplot2<span class="sc">::</span><span class="fu">guide_legend</span>(<span class="at">reverse =</span> <span class="cn">TRUE</span>))</span>
<span id="cb56-14"><a href="#cb56-14" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb56-15"><a href="#cb56-15" aria-hidden="true" tabindex="-1"></a>p</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="RiskIndicators_files/figure-html/unnamed-chunk-23-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
<p>Small copeopods make up the largest proportion in food web model diets, but are uncorrelated with condition in any region:</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb57"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb57-1"><a href="#cb57-1" aria-hidden="true" tabindex="-1"></a>p <span class="ot"><-</span> mackcondprey <span class="sc">|></span></span>
<span id="cb57-2"><a href="#cb57-2" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">filter</span>(EPU <span class="sc">!=</span> <span class="st">"SS"</span>) <span class="sc">|></span></span>
<span id="cb57-3"><a href="#cb57-3" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">ggplot</span>(ggplot2<span class="sc">::</span><span class="fu">aes</span>(<span class="at">x=</span>scaleSmCope, <span class="at">y=</span>scaleCond), <span class="at">color=</span><span class="st">"blue"</span>) <span class="sc">+</span></span>
<span id="cb57-4"><a href="#cb57-4" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">theme_bw</span>() <span class="sc">+</span></span>
<span id="cb57-5"><a href="#cb57-5" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_point</span>() <span class="sc">+</span></span>
<span id="cb57-6"><a href="#cb57-6" aria-hidden="true" tabindex="-1"></a> <span class="co">#ggplot2::geom_smooth(data=bsbcondprey, ggplot2::aes(x=scaleMacro, y=scaleCond), method="lm", col="blue") +</span></span>
<span id="cb57-7"><a href="#cb57-7" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_abline</span>(<span class="at">intercept =</span> <span class="dv">0</span>, <span class="at">slope =</span> <span class="dv">1</span>, <span class="at">lty=</span><span class="dv">3</span>) <span class="sc">+</span></span>
<span id="cb57-8"><a href="#cb57-8" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">geom_smooth</span>(<span class="at">method=</span>lm) <span class="sc">+</span></span>
<span id="cb57-9"><a href="#cb57-9" aria-hidden="true" tabindex="-1"></a> ggpubr<span class="sc">::</span><span class="fu">stat_cor</span>(<span class="at">method=</span><span class="st">"pearson"</span>, <span class="at">label.x =</span> <span class="sc">-</span><span class="fl">0.5</span>, <span class="at">label.y =</span> <span class="sc">-</span><span class="dv">2</span>) <span class="sc">+</span></span>
<span id="cb57-10"><a href="#cb57-10" aria-hidden="true" tabindex="-1"></a> ggplot2<span class="sc">::</span><span class="fu">facet_grid</span>(<span class="sc">~</span><span class="fu">factor</span>(EPU, <span class="at">levels =</span> <span class="fu">c</span>(<span class="st">"MAB"</span>, <span class="st">"GB"</span>, <span class="st">"GOM"</span>)))</span>
<span id="cb57-11"><a href="#cb57-11" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb57-12"><a href="#cb57-12" aria-hidden="true" tabindex="-1"></a>p </span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stderr">
<pre><code>`geom_smooth()` using formula = 'y ~ x'</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Removed 3 rows containing non-finite outside the scale range
(`stat_smooth()`).</code></pre>
</div>