-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMatrix_Comparisons_Microscopy_Less20.Rmd
1970 lines (1805 loc) · 95.7 KB
/
Matrix_Comparisons_Microscopy_Less20.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
title: "Microplastics Intercalibration Study Data Analysis: Matrix Comparisons, Microscopy, Particles < 20µm Only"
author: "Southern California Coastal Water Research Project, University of Toronto & State Water Resources Control Board of California"
date: "`r format(Sys.time(), '%d %B, %Y')`"
output:
html_document:
toc: true
toc_depth: 4
number_sections: true
toc_float: true
---

```{r Packages, echo = FALSE, results = 'hide', error = FALSE, warning = FALSE, message = FALSE}
#Load packages
library(tidyverse)#A ton of useful functions
library(scales)#Needed for that label wrap
library(calecopal)#Needed for color scales
library(gridExtra)#Needed to combine plots into one figure
library(knitr) #Needed to display table
library(cowplot) #Needed to combine plots
library(kableExtra) #Needed for table features (i.e., scroll_box)
library(forcats) #Needed for reordering axes
library(plotrix) #Needed for std.error fxn
```
```{r echo = FALSE, results = 'hide', error = FALSE, warning = FALSE, message = FALSE}
Full_DB <- read_csv("https://mpchecker.sccwrp.org/checker/intercal-data?table=tbl_results_master", guess_max = 10000)
Full_DB$labid <- gsub("Lab","",as.character(Full_DB$labid))
Full_DB$sampleid <- gsub("Lab","",as.character(Full_DB$sampleid))
Full_DB$particleid <- gsub("Lab","",as.character(Full_DB$particleid))
Full_DB$photoid <- gsub("Lab","",as.character(Full_DB$photoid))
Results <- Full_DB %>%
#Removed lab D - incomparable with other data - deviation from methods
filter(!(labid == "D"&sampletype == "CW")) %>%
#Removed pygcms data data
filter(!(labid == "T"&sampletype == "CW")) %>%
filter(!(labid == "F"&sampletype == "CW")) %>%
#Removed second set from Lab N - 2nd set of samples processed
filter(!(labid == "N"&sampletype == "CW"&(grepl("5|6|7|8", sampleid)))) %>%
#Removed labs that submitted clean water data late (want to match with original clean water data analysis)
filter(!(labid == "WW"&sampletype == "CW")) %>%
filter(!(labid == "NN"&sampletype == "CW")) %>%
rename("microscopy" = stereoscope) %>%
rename("nilered" = fluorescencestaining)
Lab_Info <- read_csv("https://mpchecker.sccwrp.org/checker/intercal-data?table=tbl_labinformation", guess_max = 100000) #Import .csv file containing all lab information for other matrices
#Remove "Lab" from relevant columns
Lab_Info$labid <- gsub("Lab","",as.character(Lab_Info$labid))
#Select data relating to expertise for visual microscopy
Expertise <- Lab_Info %>%
select(labid, matrix, expertiseextraction, expertisevisualmicroscopy, expertisenilered, expertiseftir, expertiseraman, expertisepy_gcms)
Results <- Results %>%
#Join expertise data to results data frame
left_join(Expertise, by = c("labid" = "labid", "sampletype" = "matrix"))
Reference <- read_csv('https://mpchecker.sccwrp.org/checker/intercal-data?table=sample_spiking_info', guess_max = 100000) #Import .csv file containing all reference spiking information for all matrices including clean water
```
```{r Results Tidying, echo = FALSE, results = 'hide', error = FALSE, warning = FALSE, message = FALSE}
Results_Clean <- Results %>%
#Create factor for nominal size fractions
mutate(sizefraction = gsub("um","µm",as.character(sizefraction))) %>%
mutate(sizefraction_f = as.factor(sizefraction)) %>%
#Create factor for colors
mutate(color_f = as.factor(color)) %>%
#Create factor for morphology
mutate(morphology_f = as.factor(morphology)) %>%
#Create factor for microscopy
mutate(microscopy_f = as.factor(microscopy)) %>%
#Rename and create factor for sample type
mutate(sampletype = case_when(
sampletype == "CW" ~ "Clean Water",
sampletype == "FT" ~ "Fish Tissue",
sampletype == "SD" ~ "Sediment",
sampletype == "DW" ~ "Dirty Water")) %>%
mutate(sampletype_f = as.factor(sampletype)) %>%
#Create a new column to indicate which samples are blanks - all sampleids with a 4 or 8
mutate(blank = ifelse(grepl("4|8", sampleid),"Y", "N")) %>%
#Distinguish between sets of samples
mutate(set = ifelse(grepl("1|2|3|4", sampleid),1,2)) %>%
#Exclude augmentation data
filter(!(labid %in% c("R","D", "L") & grepl("5|6|7|8", sampleid) & sampletype %in% c("Sediment"))) %>%
filter(!(labid %in% c("L") & grepl("5|6|7|8|9|10|11|12", sampleid) & sampletype %in% c("Fish Tissue"))) %>%
#ONLY INCLUDE SIZE FRACTIONS THAT INCLUDE 20UM OR LESS
filter(sizefraction_f %in% c("1-20 µm", "10-20 µm", "1-10 µm"))
```
```{r Microscopy Tidying, echo = FALSE, results = 'hide', error = FALSE, warning = FALSE, message = FALSE}
# Results are selected to only include particles that were identified via microscopy. Counts for unique samples and particle IDs for total, size fraction, color and morphology are calculated and a new column is created for each.
#Calculate the number of particles for each characteristic and combination
Results_Clean_Microscopy <- Results_Clean %>%
#Select particles analyzed by microscopy
filter(microscopy_f == "Yes") %>%
group_by(sampletype_f, sampleid) %>%
#Total particles per sample
mutate(total = n_distinct(sampleid, particleid)) %>%
ungroup() %>%
#Total particles by size fraction
group_by(sampletype_f, sampleid, sizefraction_f) %>%
mutate(total_sizefraction = n_distinct(sampleid, particleid)) %>%
ungroup() %>%
#Total particles by color
group_by(sampletype_f, sampleid, color_f) %>%
mutate(total_color = n_distinct(sampleid, particleid)) %>%
ungroup() %>%
#Total particles by morphology
group_by(sampletype_f, sampleid, morphology_f) %>%
mutate(total_morphology = n_distinct(sampleid, particleid)) %>%
ungroup() %>%
#Total particles by color and morphology within size fraction
group_by(sampletype_f, sampleid, sizefraction_f, color_f, morphology_f) %>%
mutate(total_color_morphology_sizefraction = n_distinct(sampleid, particleid)) %>%
ungroup() %>%
#Total particles by color and morphology
group_by(sampletype_f, sampleid, color_f, morphology_f) %>%
mutate(total_color_morphology = n_distinct(sampleid, particleid)) %>%
ungroup() %>%
#Select and rename relevant type of expertise to work for fields below
rename("expertise" = expertisevisualmicroscopy) %>%
replace_na(list(expertise = "Not Reported"))
```
```{r Reference Data Tidying, echo = FALSE, results = 'hide', error = FALSE, warning = FALSE, message = FALSE}
#Particle counts within each sample are totaled for the following categories: total, size fraction, morphology, color, and polymer. A new column is created for each categories. Values are sample specific.
Reference_Clean <- Reference %>%
#Remove small size fraction spiking data from lab R that isn't in other samples
filter(!(labid == "R" & sizefraction == "20-Jan" & sampletype == "DW")) %>%
filter(!(labid == "R" & sizefraction == "20-212" & sampletype == "DW")) %>%
#Drop spiking values of 0 or NAs
filter(!averagenumber == 0) %>%
#Create factor for color
mutate(color = case_when(
color == "white" ~ "White",
color == "orange" ~ "Orange",
color == "green" ~ "Green",
color == "red" ~ "Red",
color == "blue" ~ "Blue",
color == "clear" ~ "Clear")) %>%
mutate(color_f = as.factor(color)) %>%
#Create factor for shape
mutate(morphology = case_when(
morphology == "fragment" ~ "Fragment",
morphology == "sphere" ~ "Sphere",
morphology == "fiber" ~ "Fiber")) %>%
mutate(morphology_f = as.factor(morphology)) %>%
#Create factor for size fraction
mutate(sizefraction = case_when(
sizefraction == "20-Jan" ~ "1-20 µm",
sizefraction == "1-20" ~ "1-20 µm",
sizefraction == "20-212" ~ "20-212 µm",
sizefraction == "212-500" ~ "212-500 µm",
sizefraction == ">500" ~ ">500 µm")) %>%
mutate(sizefraction_f = as.factor(sizefraction)) %>%
mutate(plastic_f = as.factor(plastic)) %>%
mutate(sampletype = case_when(
sampletype == "CW" ~ "Clean Water",
sampletype == "FT" ~ "Fish Tissue",
sampletype == "SD" ~ "Sediment",
sampletype == "DW" ~ "Dirty Water")) %>%
mutate(sampletype_f = as.factor(sampletype)) %>%
#REMOVE SIZE FRACTIONS THAT INCLUDE 20UM OR LESS
filter(sizefraction_f %in% c("1-20 µm")) %>%
#All of the following calculations distinguish between plastic and non-plastic spikes
#Total particle spike per sample
group_by(sampletype_f, sampleid, plastic_f) %>%
mutate(total_spike = sum(averagenumber, na.rm = TRUE)) %>%
ungroup() %>%
#Total particle spike per size fraction
group_by(sampletype_f, sampleid, plastic_f, sizefraction_f) %>%
mutate(total_spike_sizefraction = sum(averagenumber, na.rm = TRUE)) %>%
ungroup() %>%
#Total particle spike per color
group_by(sampletype_f, sampleid, plastic_f, color_f) %>%
mutate(total_spike_color = sum(averagenumber, na.rm = TRUE)) %>%
ungroup() %>%
#Total particle spike per morphology
group_by(sampletype_f, sampleid, plastic_f, morphology_f) %>%
mutate(total_spike_morphology = sum(averagenumber, na.rm = TRUE)) %>%
ungroup()%>%
#Total particle spike per size fraction, color and morphology
group_by(sampletype_f, sampleid, plastic_f, sizefraction_f, color_f, morphology_f) %>%
mutate(total_spike_color_morphology_sizefraction = sum(averagenumber, na.rm = TRUE)) %>%
ungroup() %>%
#Total particle spike per color and morphology
group_by(sampletype_f, sampleid, plastic_f, color_f, morphology_f) %>%
mutate(total_spike_color_morphology = sum(averagenumber, na.rm = TRUE)) %>%
ungroup()
```
```{r echo = FALSE, error = FALSE, warning = FALSE, message = FALSE}
#Join relevant columns of reference data frame and results to compare expected counts to actual counts for microscopy only data. Recovery for each category is calculated on a sample-specific basis. A new recovery column is created for each category.
#Total
totalspikecol <- Reference_Clean %>% #Select total_spike column from reference
distinct(sampletype_f, sampleid, plastic_f, total_spike)
Join_Microscopy_Total <- inner_join(Results_Clean_Microscopy, totalspikecol, by = c("sampleid", "sampletype_f")) %>% #Join total_spike column to microscopy results data frame
mutate(total_pct_recovery = ((total/total_spike)*100)) %>% #Create a new column for the total recovery of microscopy only results
group_by(labid, set, sampletype_f, sampleid, plastic_f, microscopy_f, total, total_spike, total_pct_recovery, expertise) %>%
summarise()
#Size Fraction
sizefractionspikecol <- Reference_Clean %>%
distinct(sampletype_f, sampleid, plastic_f, sizefraction_f, total_spike_sizefraction)
sizefractionsumresults <- Results_Clean_Microscopy %>%
filter(!grepl("4", sampleid)) %>%
filter(!grepl("8", sampleid)) %>% #Dropping blank samples from results
drop_na(sizefraction_f) %>% #Drop particles not assigned to a size fraction
group_by(labid, set, sampletype_f, sampleid, microscopy_f, sizefraction_f, total_sizefraction, expertise) %>%
summarise()
Join_Microscopy_SizeFraction <- inner_join(sizefractionsumresults, sizefractionspikecol, by = c("sampleid" = "sampleid", "sizefraction_f" = "sizefraction_f", "sampletype_f")) %>%
mutate(sizefrac_pct_recovery = ((total_sizefraction/total_spike_sizefraction)*100))
#Color
colorspikecol <- Reference_Clean %>%
distinct(sampletype_f, sampleid, plastic_f, color_f, total_spike_color)
colorsumresults <- Results_Clean_Microscopy %>%
filter(!grepl("4", sampleid)) %>%
filter(!grepl("8", sampleid)) %>% #Dropping blank samples from results
group_by(labid, set, sampletype_f, sampleid, microscopy_f, color_f, total_color, expertise) %>%
summarise()
Join_Microscopy_Color <- inner_join(colorsumresults, colorspikecol, by = c("sampleid" = "sampleid", "color_f" = "color_f", "sampletype_f")) %>%
mutate(color_pct_recovery = ((total_color/total_spike_color)*100))
#Morphology
morphologyspikecol <- Reference_Clean %>%
distinct(sampletype_f, sampleid, plastic_f, morphology_f, total_spike_morphology)
morphologysumresults <- Results_Clean_Microscopy %>%
filter(!grepl("4", sampleid)) %>%
filter(!grepl("8", sampleid)) %>% #Dropping blank samples from results
group_by(labid, set, sampletype_f, sampleid, microscopy_f, morphology_f, total_morphology, expertise) %>%
summarise()
Join_Microscopy_Morphology <- inner_join(morphologysumresults, morphologyspikecol, by = c("sampleid" = "sampleid", "morphology_f" = "morphology_f", "sampletype_f")) %>%
mutate(morphology_pct_recovery = ((total_morphology/total_spike_morphology)*100))
#Combination - Color and Morphology Only
combocmspikecol <- Reference_Clean %>%
distinct(sampletype_f, sampleid, plastic_f, color_f, morphology_f, total_spike_color_morphology)
combosumresultscm <- Results_Clean_Microscopy %>%
filter(!grepl("4", sampleid)) %>%
filter(!grepl("8", sampleid)) %>% #Dropping blank samples from results
group_by(labid, set, sampletype_f, sampleid, microscopy_f, color_f, morphology_f, total_color_morphology, expertise) %>%
summarise()
Join_Microscopy_Combo_CM <- inner_join(combosumresultscm, combocmspikecol, by = c("sampleid" = "sampleid", "morphology_f" = "morphology_f", "color_f" = "color_f", "sampletype_f")) %>%
mutate(color_morphology_pct_recovery = ((total_color_morphology/total_spike_color_morphology)*100))
#Combination - Size Fraction, Color and Morphology
combospikecol <- Reference_Clean %>%
distinct(sampletype_f, sampleid, plastic_f, sizefraction_f, color_f, morphology_f, total_spike_color_morphology_sizefraction)
combosumresults <- Results_Clean_Microscopy %>%
filter(!grepl("4", sampleid)) %>%
filter(!grepl("8", sampleid)) %>% #Dropping blank samples from results
drop_na(sizefraction_f) %>% #Drop particles not assigned to a size fraction
group_by(labid, set, sampletype_f, sampleid, microscopy_f, sizefraction_f, color_f, morphology_f, total_color_morphology_sizefraction, expertise) %>%
summarise()
Join_Microscopy_Combo <- inner_join(combosumresults, combospikecol, by = c("sampleid" = "sampleid", "morphology_f" = "morphology_f", "color_f" = "color_f", "sizefraction_f" = "sizefraction_f", "sampletype_f")) %>%
mutate(color_morphology_sizefraction_pct_recovery = ((total_color_morphology_sizefraction/total_spike_color_morphology_sizefraction)*100))
```
# Spiking Summary
```{r echo = FALSE, error = FALSE, warning = FALSE, message = FALSE}
#total spike
a <- Reference_Clean %>%
distinct(sampletype_f, sampleid, plastic_f, total_spike) %>%
group_by(sampletype_f, plastic_f) %>%
mutate(total_spike_mean = mean(total_spike)) %>%
mutate(total_spike_sd = sd(total_spike)) %>%
ungroup() %>%
group_by(sampletype_f, plastic_f, total_spike_mean, total_spike_sd) %>%
summarise() %>%
rename("Matrix" = sampletype_f, "Plastic?" = plastic_f, "Number of Spiked Particles" = total_spike_mean, "Standard Deviation" = total_spike_sd)
kable(a, digits = 2, caption = "Average Number of Spiked Particles per Sample") %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
scroll_box(width = "700px", height = "200px")
#size fraction
b <- Reference_Clean %>%
distinct(sampletype_f, sampleid, plastic_f, sizefraction_f, total_spike_sizefraction) %>%
group_by(sampletype_f, plastic_f, sizefraction_f) %>%
mutate(total_spike_mean = mean(total_spike_sizefraction)) %>%
mutate(total_spike_sd = sd(total_spike_sizefraction)) %>%
ungroup() %>%
group_by(sampletype_f, plastic_f, sizefraction_f, total_spike_mean, total_spike_sd) %>%
summarise() %>%
rename("Matrix" = sampletype_f, "Plastic?" = plastic_f, "Size Fraction" = sizefraction_f, "Number of Spiked Particles" = total_spike_mean,
"Standard Deviation" = total_spike_sd)
kable(b, digits = 2, caption = "Average Number of Spiked Particles per Sample by Size Fraction") %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
scroll_box(width = "700px", height = "200px")
#color
c <- Reference_Clean %>%
distinct(sampletype_f, sampleid, plastic_f, color_f, total_spike_color) %>%
group_by(sampletype_f, plastic_f, color_f) %>%
mutate(total_spike_mean = mean(total_spike_color)) %>%
mutate(total_spike_sd = sd(total_spike_color)) %>%
ungroup() %>%
group_by(sampletype_f, plastic_f, color_f, total_spike_mean, total_spike_sd) %>%
summarise() %>%
rename("Matrix" = sampletype_f, "Plastic?" = plastic_f, "Color" = color_f, "Number of Spiked Particles" = total_spike_mean,
"Standard Deviation" = total_spike_sd)
kable(c, digits = 2, caption = "Average Number of Spiked Particles per Sample by Color") %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
scroll_box(width = "700px", height = "200px")
#morphology
d <- Reference_Clean %>%
distinct(sampletype_f, sampleid, plastic_f, morphology_f, total_spike_morphology) %>%
group_by(sampletype_f, plastic_f, morphology_f) %>%
mutate(total_spike_mean = mean(total_spike_morphology)) %>%
mutate(total_spike_sd = sd(total_spike_morphology)) %>%
ungroup() %>%
group_by(sampletype_f, plastic_f, morphology_f, total_spike_mean, total_spike_sd) %>%
summarise() %>%
rename("Matrix" = sampletype_f, "Plastic?" = plastic_f, "Morphology" = morphology_f, "Number of Spiked Particles" = total_spike_mean,
"Standard Deviation" = total_spike_sd)
kable(d, digits = 2, caption = "Average Number of Spiked Particles per Sample by Morphology") %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
scroll_box(width = "700px", height = "200px")
#morphology & color within size fraction
e <- Reference_Clean %>%
distinct(sampletype_f, sampleid, plastic_f, morphology_f, color_f, sizefraction_f, total_spike_color_morphology_sizefraction) %>%
group_by(sampletype_f, plastic_f, morphology_f, color_f, sizefraction_f) %>%
mutate(total_spike_mean = mean(total_spike_color_morphology_sizefraction)) %>%
mutate(total_spike_sd = sd(total_spike_color_morphology_sizefraction)) %>%
ungroup() %>%
group_by(sampletype_f, plastic_f, morphology_f, color_f, sizefraction_f, total_spike_mean, total_spike_sd) %>%
summarise() %>%
rename("Matrix" = sampletype_f, "Plastic?" = plastic_f, "Morphology" = morphology_f, "Color" = color_f, "Size Fraction" = sizefraction_f,
"Number of Spiked Particles" = total_spike_mean, "Standard Deviation" = total_spike_sd)
kable(e, digits = 2, caption = "Average Number of Spiked Particles per Sample by Morphology & Color Within Size Fraction") %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
scroll_box(width = "700px", height = "200px")
```
# Counts
The following section describes data as absolute particle counts that were reported in each sample. Note that Dirty Water samples were not spiked with any particles less than 212µm and are therefore distinct from the other matrices.
```{r echo = FALSE, error = FALSE, warning = FALSE, message = FALSE, fig.width = 12, fig.height = 10}
spike <- Join_Microscopy_Total %>%
#Remove spiked particles with problematic RSD
filter(!(labid == "R" & sampletype_f == "Clean Water")) %>%
filter(plastic_f != "N") %>%
ungroup() %>%
group_by(sampletype_f) %>%
mutate(mean_spike = mean(total_spike))
#Total - By Lab
a <- Results_Clean_Microscopy %>%
#Data manipulation
filter(!grepl("4", sampleid)) %>%
filter(!grepl("8", sampleid)) %>% #Dropping blanks
group_by(labid, sampleid, total, expertise, sampletype_f) %>%
summarise() %>%
ungroup() %>%
mutate(labid = fct_reorder(labid, expertise)) %>%
#Creating plot
ggplot(aes(x= labid, y= total)) +
theme_test() +
geom_point(aes(color = as.factor(expertise), fill = as.factor(expertise)), alpha = 0.7, width = .05, size = 3) +
geom_hline(data = spike, aes(yintercept = mean_spike), linetype = "dotted")+
stat_summary(fun="mean", geom="segment", mapping=aes(xend=..x.. - 0.25, yend=..y..))+
stat_summary(fun="mean", geom="segment", mapping=aes(xend=..x.. + 0.25, yend=..y..))+
theme(text = element_text(size = 12),
plot.title = element_text(hjust = 0.5),
plot.subtitle = element_text(hjust = 0.5),
legend.position = "right",
axis.text.x = element_text(angle = 45, vjust = 1, hjust=1),
axis.ticks.x = element_blank())+
scale_fill_manual(values = c("royalblue", "darkcyan", "darkblue", "orchid"))+
scale_color_manual(values = c("royalblue", "darkcyan", "darkblue", "orchid"))+
facet_wrap(~sampletype_f, ncol = 2)+
expand_limits(y = 0) +
labs(x = "Labs", y = "Particle Count", fill = "Experience", color = "Experience", title = "Microscopy", subtitle = "Raw Particle Count", caption = "Points represent individual samples spiked with microplastic particles.\nDotted line represents the number of spiked polymer particles.\nNot blank corrected.")
plot(a)
b <- Results_Clean_Microscopy %>%
filter(blank != "Y") %>%
select(sampletype_f, labid, sampleid, total) %>%
rename("Matrix" = sampletype_f) %>%
rename("Lab ID" = labid) %>%
rename("Sample ID" = sampleid) %>%
rename("Total Particles" = total) %>%
distinct()
kable(b, digits = 2, caption = "Raw Particle Count. Summary statistics by sample (n = 1-3 samples). Not blank corrected.") %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
scroll_box(width = "700px", height = "200px")
#Total - Summary
c <- Results_Clean_Microscopy %>%
filter(!grepl("4", sampleid)) %>%
filter(!grepl("8", sampleid)) %>% #Dropping blanks
group_by(labid, sampleid, set, microscopy_f, total, sampletype_f) %>%
summarise() %>%
group_by(labid) %>%
mutate(total_mean = mean(total)) %>%
ungroup() %>%
group_by(labid, microscopy_f, total_mean, sampletype_f) %>%
summarise() %>%
#Creating plot
ggplot(aes(x=microscopy_f, y= total_mean)) +
theme_test() +
geom_point(aes(color = microscopy_f, fill = microscopy_f, alpha = 0.7), width = .05, size = 3) +
geom_hline(data = spike, aes(yintercept = mean_spike), linetype = "dotted")+
geom_boxplot(alpha = 0.5,aes(color = microscopy_f, fill = microscopy_f), outlier.shape = NA) +
theme(text = element_text(size = 12),
plot.title = element_text(hjust = 0.5),
plot.subtitle = element_text(hjust = 0.5),
legend.position = "none",
axis.text.x = element_blank(),
axis.title.x = element_blank(),
axis.ticks.x = element_blank())+
scale_color_manual(values = c("darkmagenta")) +
scale_fill_manual(values = c("darkmagenta")) +
facet_wrap(~sampletype_f, ncol = 2)+
expand_limits(y = 0) +
labs(y = "Particle Count", fill = "Lab", title = "Microscopy", subtitle = "Raw Particle Count", caption = "Points represent the sample mean (n = 1-3) of each laboratory.\nDotted line represents the number of spiked polymer particles.\nNot blank corrected.")
plot(c)
d <- Results_Clean_Microscopy %>%
filter(blank != "Y") %>%
group_by(sampletype_f, labid, set, total) %>%
summarise() %>%
mutate(`Mean`= mean(total)) %>%
mutate(`Median` = median(total)) %>%
mutate(`SD` = sd(total)) %>%
mutate(`Min` = min(total)) %>%
mutate(`Max` = max(total)) %>%
ungroup() %>%
select(sampletype_f, labid, `Mean`, `Median`, `SD`, `Min`, `Max`) %>%
rename("Matrix" = sampletype_f) %>%
rename("Lab ID" = labid) %>%
distinct()
kable(d, digits = 2, caption = "Raw Particle Count. Summary statistics by laboratory (n = 1-3 samples). Not blank corrected.") %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
scroll_box(width = "700px", height = "200px")
e <- Results_Clean_Microscopy %>%
filter(!grepl("4", sampleid)) %>%
filter(!grepl("8", sampleid)) %>% #Dropping blanks
group_by(sampletype_f, labid, set, total) %>%
summarise() %>%
mutate(total_mean = mean(total)) %>%
ungroup() %>%
distinct(sampletype_f, labid, total_mean) %>%
group_by(sampletype_f) %>%
mutate(`Mean`= mean(total_mean)) %>%
mutate(`Median` = median(total_mean)) %>%
mutate(`SD` = sd(total_mean)) %>%
mutate(`Min` = min(total_mean)) %>%
mutate(`Max` = max(total_mean)) %>%
ungroup() %>%
select(sampletype_f, `Mean`, `Median`, `SD`, `Min`, `Max`) %>%
rename("Matrix" = sampletype_f) %>%
distinct()
kable(e, digits = 2, caption = "Raw Particle Count. Global summary statistics. Not blank corrected.")%>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
scroll_box(width = "700px", height = "200px")
```
# Clean Water, Fish Tissue and Sediment Comparisons
Clean Water, Fish Tissue and Sediment samples were spiked with the same materials. Therefore, comparisons may be made for all particle types.
## Recovery
The following plots display the recovery (reported count/spiked count (%)) obtained from microscopy. **Reported particle characteristics must match expected particle characteristics of the spiking materials to count towards recovery estimations.** For example, the colors of polymer spiking materials are defined as white, orange, blue, clear and green. Colors outside of these definitions are not included in this section (see Counts).
The dotted line is at 100% and the grey area represents the mean RSD for each given category. The data are **not** blank corrected.
Recovery in this section is estimated based on a single particle characteristic. For example, if the sample was spiked with 10 green particles and 8 green particles were recovered, recovery is estimated as 80% regardless of whether or not the shape or size fraction also matches the spiking material. More restrictive recovery analysis are reported later on in this document.
### Total
```{r echo = FALSE, error = FALSE, warning = FALSE, message = FALSE, fig.width = 12, fig.height = 10, fig.height = 10}
#Total - By Lab
a <- Join_Microscopy_Total %>%
filter(!(labid == "R"&sampletype_f == "Clean Water")) %>%
filter(sampletype_f != "Dirty Water") %>%
filter(plastic_f != "N") %>%
ungroup() %>%
mutate(labid = fct_reorder(labid, expertise)) %>%
#Creating plot
ggplot(aes(x=labid, y= total_pct_recovery)) +
theme_test() +
geom_rect(ymin = 95.7, ymax = 104.3, xmin = 0, xmax = Inf, color = "gray87", fill = "gray87", alpha = 0.5)+
geom_point(aes(color = as.factor(expertise), fill = as.factor(expertise)), alpha = 0.7, width = .05, size = 3) +
geom_hline(yintercept = 100, linetype = "dotted")+
stat_summary(fun="mean", geom="segment", mapping=aes(xend=..x.. - 0.25, yend=..y..))+
stat_summary(fun="mean", geom="segment", mapping=aes(xend=..x.. + 0.25, yend=..y..))+
facet_wrap(~sampletype_f, ncol = 3)+
theme(text = element_text(size = 12),
plot.title = element_text(hjust = 0.5),
plot.subtitle = element_text(hjust = 0.5),
legend.position = "right",
axis.text.x = element_text(angle = 45, vjust = 1, hjust=1),
axis.ticks.x = element_blank())+
scale_fill_manual(values = c("royalblue", "darkcyan", "darkblue", "orchid"))+
scale_color_manual(values = c("royalblue", "darkcyan", "darkblue", "orchid"))+
expand_limits(y = 0) +
labs(x = "Labs", y = "Recovery (%)", fill = "Experience", color = "Experience", title = "Microscopy", subtitle = "Total Particle Recovery", caption = "Points represent individual samples spiked with microplastic particles.\nDotted line and shaded area represent 100% recovery of polymer materials and RSD, respectively.\nNot blank corrected.")
plot(a)
#Total - By Lab
a_a <- Join_Microscopy_Total %>%
filter(!(labid == "R"&sampletype_f == "Clean Water")) %>%
filter(sampletype_f != "Dirty Water") %>%
filter(plastic_f != "N") %>%
ungroup() %>%
group_by(labid) %>%
mutate(All_Matrices = if_else(n_distinct(sampletype_f) == 3, "Y", "N")) %>%
filter(All_Matrices == "Y") %>%
ungroup() %>%
#Creating plot
ggplot(aes(x=labid, y= total_pct_recovery)) +
theme_test() +
geom_rect(ymin = 95.7, ymax = 104.3, xmin = 0, xmax = Inf, color = "gray87", fill = "gray87", alpha = 0.5)+
geom_point(aes(color = sampletype_f, fill = sampletype_f, group = sampletype_f), alpha = 0.7, width = .05, size = 3, position = position_dodge(width = 0.75)) +
geom_boxplot(alpha = 0.5,aes(color = sampletype_f, fill =sampletype_f), outlier.shape = NA) +
geom_hline(yintercept = 100, linetype = "dotted")+
theme(text = element_text(size = 12),
plot.title = element_text(hjust = 0.5),
plot.subtitle = element_text(hjust = 0.5),
legend.position = "right",
axis.text.x = element_text(angle = 45, vjust = 1, hjust=1),
axis.ticks.x = element_blank())+
scale_fill_manual(values = c("royalblue", "darksalmon", "goldenrod4"))+
scale_color_manual(values = c("royalblue", "darksalmon", "goldenrod4"))+
expand_limits(y = 0) +
labs(x = "Labs", y = "Recovery (%)", fill = "Matrix", color = "Matrix", title = "Microscopy", subtitle = "Total Particle Recovery", caption = "Points represent individual samples spiked with microplastic particles.\nDotted line and shaded area represent 100% recovery of polymer materials and RSD, respectively.\nNot blank corrected.")
plot(a_a)
b <- Join_Microscopy_Total %>%
filter(!(labid == "R"&sampletype_f == "Clean Water")) %>%
filter(sampletype_f != "Dirty Water") %>%
filter(plastic_f != "N") %>%
group_by(sampletype_f, labid, sampleid, total_pct_recovery) %>%
summarise() %>%
rename("Matrix" = sampletype_f) %>%
rename("Lab ID" = labid) %>%
rename("Sample ID" = sampleid) %>%
rename("Recovery" = total_pct_recovery) %>%
distinct()
kable(b, digits = 2, caption = "Microscopy: Total Particle Recovery. Summary statistics by sample (n = 1-3 samples). Not blank corrected.") %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
scroll_box(width = "700px", height = "200px")
#Total - Summary
c<- Join_Microscopy_Total %>%
filter(!(labid == "R"&sampletype_f == "Clean Water")) %>%
filter(sampletype_f != "Dirty Water") %>%
filter(plastic_f != "N") %>%
#Data manipulation
group_by(sampletype_f, labid, sampleid, set, microscopy_f, total_pct_recovery) %>%
summarise() %>%
group_by(sampletype_f, labid) %>%
mutate(total_pct_recovery_mean = mean(total_pct_recovery)) %>%
ungroup() %>%
group_by(sampletype_f, labid, microscopy_f, total_pct_recovery_mean) %>%
summarise() %>%
#Creating plot
ggplot(aes(x=microscopy_f, y= total_pct_recovery_mean)) +
theme_test() +
geom_rect(ymin = 95.7, ymax = 104.3, xmin = 0, xmax = Inf, color = "gray87", fill = "gray87", alpha = 0.5)+
geom_point(aes(color = sampletype_f, fill = sampletype_f, alpha = 0.7), width = .05, size = 3) +
geom_boxplot(alpha = 0.5,aes(color = sampletype_f, fill = sampletype_f), outlier.shape = NA) +
geom_hline(yintercept = 100, linetype = "dotted")+
facet_wrap(~sampletype_f, ncol = 3)+
theme(text = element_text(size = 12),
plot.title = element_text(hjust = 0.5),
plot.subtitle = element_text(hjust = 0.5),
legend.position = "none",
axis.text.x = element_blank(),
axis.title.x = element_blank(),
axis.ticks.x = element_blank())+
scale_color_manual(values = c("royalblue", "darksalmon", "goldenrod4")) +
scale_fill_manual(values = c("royalblue", "darksalmon", "goldenrod4")) +
expand_limits(y = 0) +
labs(y = "Recovery (%)", fill = "Lab", title = "Microscopy", subtitle = "Total Particle Recovery", caption = "Points represent the sample mean (n = 1-3) of each laboratory.\nDotted line and shaded area represent 100% recovery of polymer materials and RSD, respectively.\nNot blank corrected.")
plot(c)
d <- Join_Microscopy_Total %>%
filter(!(labid == "R"&sampletype_f == "Clean Water")) %>%
filter(sampletype_f != "Dirty Water") %>%
filter(plastic_f != "N") %>%
group_by(sampletype_f, labid, set) %>%
mutate(`Mean (%)`= mean(total_pct_recovery)) %>%
mutate(`Median (%)` = median(total_pct_recovery)) %>%
mutate(`SD (%)` = sd(total_pct_recovery)) %>%
mutate(`SE (%)` = std.error(total_pct_recovery)) %>%
mutate(`Min (%)` = min(total_pct_recovery)) %>%
mutate(`Max (%)` = max(total_pct_recovery)) %>%
ungroup() %>%
select(sampletype_f, labid, `Mean (%)`, `Median (%)`, `SD (%)`, `SE (%)`, `Min (%)`, `Max (%)`) %>%
rename("Matrix" = sampletype_f) %>%
rename("Lab ID" = labid) %>%
distinct()
kable(d, digits = 2, caption = "Microscopy: Total Particle Recovery. Summary statistics by laboratory (n = 1-3 samples). Not blank corrected.") %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
scroll_box(width = "700px", height = "200px")
e <- Join_Microscopy_Total %>%
filter(!(labid == "R"&sampletype_f == "Clean Water")) %>%
filter(sampletype_f != "Dirty Water") %>%
filter(plastic_f != "N") %>%
group_by(sampletype_f, labid, set) %>%
mutate(mean_lab = mean(total_pct_recovery)) %>%
ungroup() %>%
distinct(sampletype_f, labid, mean_lab) %>%
group_by(sampletype_f) %>%
mutate(`Mean (%)`= mean(mean_lab)) %>%
mutate(`Median (%)` = median(mean_lab)) %>%
mutate(`SD (%)` = sd(mean_lab)) %>%
mutate(`SE (%)` = std.error(mean_lab)) %>%
mutate(`Min (%)` = min(mean_lab)) %>%
mutate(`Max (%)` = max(mean_lab)) %>%
ungroup() %>%
rename("Matrix" = sampletype_f) %>%
select(`Matrix`, `Mean (%)`, `Median (%)`, `SD (%)`, `SE (%)`, `Min (%)`, `Max (%)`) %>%
distinct()
kable(e, digits = 2, caption = "Microscopy: Total Particle Recovery. Summary statistics across all laboratories. Not blank corrected.")%>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
scroll_box(width = "700px", height = "200px")
```
```{r Manuscript Fig 1A, echo = FALSE, error = FALSE, warning = FALSE, message = FALSE, include = FALSE}
#Total - Summary
Fig1A<- Join_Microscopy_Total %>%
filter(!(labid == "R"&sampletype_f == "Clean Water")) %>%
filter(sampletype_f != "Dirty Water") %>%
filter(plastic_f != "N") %>%
mutate(sampletype_f = case_when(
sampletype_f == "Clean Water" ~ "Drinking Water",
sampletype_f == "Fish Tissue" ~ "Fish Tissue",
sampletype_f == "Sediment" ~ "Sediment")) %>%
#Data manipulation
group_by(sampletype_f, labid, set, sampleid, microscopy_f, total_pct_recovery) %>%
summarise() %>%
group_by(sampletype_f, labid) %>%
mutate(total_pct_recovery_mean = mean(total_pct_recovery)) %>%
ungroup() %>%
group_by(sampletype_f, labid, microscopy_f, total_pct_recovery_mean) %>%
summarise() %>%
#Creating plot
ggplot(aes(x=sampletype_f, y= total_pct_recovery_mean)) +
theme_test() +
geom_point(aes(color = sampletype_f, fill = sampletype_f, alpha = 0.7), width = .05, size = 3) +
geom_boxplot(alpha = 0.5,aes(color = sampletype_f, fill = sampletype_f), outlier.shape = NA) +
geom_hline(yintercept = 100, linetype = "dotted")+
theme(text = element_text(size = 20),
plot.title = element_text(hjust = .5, vjust = -6),
legend.position = "none",
axis.title.x = element_blank(),
axis.ticks.x = element_blank())+
scale_color_manual(values = c("royalblue", "darksalmon", "goldenrod4")) +
scale_fill_manual(values = c("royalblue", "darksalmon", "goldenrod4")) +
expand_limits(y = 0) +
ylim(0,250)+
labs(y = "Recovery (%)", title = "< 20 µm")
plot(Fig1A)
saveRDS(Fig1A, file = "./Manuscript_Figures/Fig1A")
```
```{r Manuscript Figure S5A, echo = FALSE, error = FALSE, warning = FALSE, message = FALSE, include = FALSE}
#Total - By Lab
FigS5A <- Join_Microscopy_Total %>%
filter(!(labid == "R"&sampletype_f == "Clean Water")) %>%
filter(sampletype_f != "Dirty Water") %>%
filter(plastic_f != "N") %>%
mutate(sampletype_f = case_when(
sampletype_f == "Clean Water" ~ "Drinking Water",
sampletype_f == "Fish Tissue" ~ "Fish Tissue",
sampletype_f == "Sediment" ~ "Sediment")) %>%
ungroup() %>%
#Creating plot
ggplot(aes(x=labid, y= total_pct_recovery)) +
theme_test() +
geom_point(aes(color = sampletype_f, fill = sampletype_f, alpha = 0.7), size = 3) +
geom_hline(yintercept = 100, linetype = "dotted")+
stat_summary(fun="mean", geom="segment", mapping=aes(xend=..x.. - 0.25, yend=..y..))+
stat_summary(fun="mean", geom="segment", mapping=aes(xend=..x.. + 0.25, yend=..y..))+
facet_wrap(~sampletype_f, ncol = 3)+
theme(text = element_text(size = 20),
legend.position = "none",
plot.title = element_text(hjust = 0.5),
axis.text.x = element_text(angle = 45, vjust = 1, hjust=1),
axis.ticks.x = element_blank())+
scale_fill_manual(values = c("royalblue", "darksalmon", "goldenrod4"))+
scale_color_manual(values = c("royalblue", "darksalmon", "goldenrod4"))+
expand_limits(y = 0) +
labs(y = "Recovery (%)", x = "Lab", title = "< 20 µm")
plot(FigS5A)
saveRDS(FigS5A, file = "./Manuscript_Figures/FigS5A")
```
### Size Fraction
```{r echo = FALSE, error = FALSE, warning = FALSE, message = FALSE, fig.width = 12, fig.height = 10}
# #All Size Fractions
# a <- Join_Microscopy_SizeFraction %>%
# filter(sampletype_f != "Dirty Water") %>%
# filter(plastic_f != "N") %>%
# ungroup() %>%
# mutate(labid = fct_reorder(labid, expertise)) %>%
# #Force size fractions to be in the correct order
# mutate(sizefraction_f = factor(sizefraction_f, levels = c("1-20 µm", "20-212 µm","212-500 µm",">500 µm"))) %>%
# #Data manipulation
# group_by(sampletype_f, labid, set, sampleid, microscopy_f, sizefraction_f, sizefrac_pct_recovery) %>%
# summarise() %>%
# group_by(sampletype_f, labid, sizefraction_f) %>%
# mutate(sizefrac_pct_recovery_mean = mean(sizefrac_pct_recovery)) %>%
# ungroup() %>%
# group_by(sampletype_f, labid, microscopy_f, sizefraction_f, sizefrac_pct_recovery_mean) %>%
# summarise() %>%
# #Creating plot
# ggplot(aes(x=sampletype_f, y= sizefrac_pct_recovery_mean)) +
# theme_test() +
# geom_point(aes(color = microscopy_f, fill = microscopy_f, alpha = 0.7), width = .05, size = 3) +
# geom_boxplot(alpha = 0.5,aes(color = microscopy_f, fill = microscopy_f), outlier.shape = NA) +
# geom_hline(yintercept = 100, linetype = "dotted")+
# facet_wrap(~sizefraction_f, ncol = 2, scales = "free")+
# theme(text = element_text(size = 13),
# plot.title = element_text(hjust = 0.5),
# plot.subtitle = element_text(hjust = 0.5),
# legend.position = "none",
# axis.text.x = element_text(angle = 45, vjust = 1, hjust=1),
# axis.title.x = element_blank(),
# axis.ticks.x = element_blank())+
# scale_color_manual(values = c("darkmagenta")) +
# scale_fill_manual(values = c("darkmagenta")) +
# expand_limits(y = 0) +
# labs(y = "Recovery (%)", fill = "Lab", title = "Microscopy", subtitle = "Particle Recovery, All Size Fractions", caption = "Points represent the sample mean (n = 1-3) of each laboratory.\nDotted line represents 100% recovery of polymer materials.\nNot blank corrected.")
#
# plot(a)
#1-20µm - By Lab
b <- Join_Microscopy_SizeFraction %>%
filter(sampletype_f != "Dirty Water") %>%
filter(plastic_f != "N") %>%
filter(sizefraction_f == "1-20 µm") %>%
ungroup() %>%
mutate(labid = fct_reorder(labid, expertise)) %>%
#Creating plot
ggplot(aes(x=labid, y= sizefrac_pct_recovery)) +
theme_test() +
#No RSD data for the 1-20 µm size fraction
geom_point(aes(color = as.factor(expertise), fill = as.factor(expertise)), alpha = 0.7, width = .05, size = 3) +
geom_hline(yintercept = 100, linetype = "dotted")+
stat_summary(fun="mean", geom="segment", mapping=aes(xend=..x.. - 0.25, yend=..y..))+
stat_summary(fun="mean", geom="segment", mapping=aes(xend=..x.. + 0.25, yend=..y..))+
facet_wrap(~sampletype_f, ncol = 3)+
theme(text = element_text(size = 12),
plot.title = element_text(hjust = 0.5),
plot.subtitle = element_text(hjust = 0.5),
legend.position = "right",
axis.text.x = element_text(angle = 45, vjust = 1, hjust=1),
axis.ticks.x = element_blank())+
scale_fill_manual(values = c("royalblue", "darkcyan", "darkblue"))+
scale_color_manual(values = c("royalblue", "darkcyan", "darkblue"))+
expand_limits(y = 0) +
labs(x = "Labs", y = "Recovery (%)", fill = "Experience", color = "Experience", title = "Microscopy", subtitle = "Particle Recovery, 1-20 µm", caption = "Points represent individual samples spiked with microplastic particles.\nDotted line represents 100% recovery of polymer materials.\nNot blank corrected.")
plot(b)
#1-20µm - Summary
c <- Join_Microscopy_SizeFraction %>%
filter(sampletype_f != "Dirty Water") %>%
filter(plastic_f != "N") %>%
#Data manipulation
group_by(sampletype_f, labid, sampleid, microscopy_f, sizefraction_f, sizefrac_pct_recovery) %>%
summarise() %>%
group_by(sampletype_f, labid, sizefraction_f) %>%
mutate(sizefrac_pct_recovery_mean = mean(sizefrac_pct_recovery)) %>%
ungroup() %>%
filter(sizefraction_f == "1-20 µm") %>%
group_by(sampletype_f, labid, microscopy_f, sizefrac_pct_recovery_mean) %>%
summarise() %>%
#Creating plot
ggplot(aes(x=microscopy_f, y= sizefrac_pct_recovery_mean)) +
theme_test() +
#No RSD data for the 1-20 µm size fraction
geom_point(aes(color = microscopy_f, fill = microscopy_f, alpha = 0.7), width = .05, size = 3) +
geom_boxplot(alpha = 0.5,aes(color = microscopy_f, fill = microscopy_f), outlier.shape = NA) +
geom_hline(yintercept = 100, linetype = "dotted")+
facet_wrap(~sampletype_f, ncol = 3)+
theme(text = element_text(size = 12),
plot.title = element_text(hjust = 0.5),
plot.subtitle = element_text(hjust = 0.5),
legend.position = "none",
axis.text.x = element_blank(),
axis.title.x = element_blank(),
axis.ticks.x = element_blank())+
scale_color_manual(values = c("darkmagenta")) +
scale_fill_manual(values = c("darkmagenta")) +
expand_limits(y = 0) +
labs(y = "Recovery (%)", fill = "Lab", title = "Microscopy", subtitle = "Particle Recovery, 1-20 µm", caption = "Points represent the sample mean (n = 1-3) of each laboratory.\nDotted line represents 100% recovery of polymer materials.\nNot blank corrected.")
plot(c)
# #20-212 µm - By Lab
# d <- Join_Microscopy_SizeFraction %>%
# filter(sampletype_f != "Dirty Water") %>%
# filter(plastic_f != "N") %>%
# filter(sizefraction_f == "20-212 µm") %>%
# ungroup() %>%
# mutate(labid = fct_reorder(labid, expertise)) %>%
# #Creating plot
# ggplot(aes(x=labid, y= sizefrac_pct_recovery)) +
# theme_test() +
# geom_rect(ymin = 91.6, ymax = 108.4, xmin = 0, xmax = Inf, color = "gray87", fill = "gray87", alpha = 0.5)+
# geom_point(aes(color = as.factor(expertise), fill = as.factor(expertise)), alpha = 0.7, width = .05, size = 3) +
# geom_hline(yintercept = 100, linetype = "dotted")+
# stat_summary(fun="mean", geom="segment", mapping=aes(xend=..x.. - 0.25, yend=..y..))+
# stat_summary(fun="mean", geom="segment", mapping=aes(xend=..x.. + 0.25, yend=..y..))+
# facet_wrap(~sampletype_f, ncol = 3)+
# theme(text = element_text(size = 12),
# plot.title = element_text(hjust = 0.5),
# plot.subtitle = element_text(hjust = 0.5),
# legend.position = "right",
# axis.text.x = element_text(angle = 45, vjust = 1, hjust=1),
# axis.ticks.x = element_blank())+
# scale_fill_manual(values = c("royalblue", "darkcyan", "darkblue"))+
# scale_color_manual(values = c("royalblue", "darkcyan", "darkblue"))+
# expand_limits(y = 0) +
# labs(x = "Labs", y = "Recovery (%)", fill = "Experience", color = "Experience", title = "Microscopy", subtitle = "Particle Recovery, 20-212 µm", caption = "Points represent individual samples spiked with microplastic particles.\nDotted line and shaded area represent 100% recovery of polymer materials and RSD, respectively.\nNot blank corrected.")
#
# plot(d)
#
# #20-212 µm - Summary
# e <- Join_Microscopy_SizeFraction %>%
# filter(sampletype_f != "Dirty Water") %>%
# filter(plastic_f != "N") %>%
# #Data manipulation
# group_by(sampletype_f, labid, set, sampleid, microscopy_f, sizefraction_f, sizefrac_pct_recovery) %>%
# summarise() %>%
# group_by(sampletype_f, labid, sizefraction_f) %>%
# mutate(sizefrac_pct_recovery_mean = mean(sizefrac_pct_recovery)) %>%
# ungroup() %>%
# filter(sizefraction_f == "20-212 µm") %>%
# group_by(sampletype_f, labid, microscopy_f, sizefrac_pct_recovery_mean) %>%
# summarise() %>%
# #Creating plot
# ggplot(aes(x=microscopy_f, y= sizefrac_pct_recovery_mean)) +
# theme_test() +
# geom_rect(ymin = 91.6, ymax = 108.4, xmin = 0, xmax = Inf, color = "gray87", fill = "gray87", alpha = 0.5)+
# geom_point(aes(color = microscopy_f, fill = microscopy_f, alpha = 0.7), width = .05, size = 3) +
# geom_boxplot(alpha = 0.5,aes(color = microscopy_f, fill = microscopy_f), outlier.shape = NA) +
# geom_hline(yintercept = 100, linetype = "dotted")+
# facet_wrap(~sampletype_f, ncol = 3)+
# theme(text = element_text(size = 12),
# plot.title = element_text(hjust = 0.5),
# plot.subtitle = element_text(hjust = 0.5),
# legend.position = "none",
# axis.text.x = element_blank(),
# axis.title.x = element_blank(),
# axis.ticks.x = element_blank())+
# scale_color_manual(values = c("darkmagenta")) +
# scale_fill_manual(values = c("darkmagenta")) +
# expand_limits(y = 0) +
# labs(y = "Recovery (%)", fill = "Lab", title = "Microscopy", subtitle = "Particle Recovery, 20-212 µm", caption = "Points represent the sample mean (n = 1-3) of each laboratory.\nDotted line and shaded area represent 100% recovery of polymer materials and RSD, respectively.\nNot blank corrected.")
#
# plot(e)
#
# #212-500 µm - By Lab
# f <- Join_Microscopy_SizeFraction %>%
# filter(sampletype_f != "Dirty Water") %>%
# filter(plastic_f != "N") %>%
# filter(sizefraction_f == "212-500 µm") %>%
# ungroup() %>%
# mutate(labid = fct_reorder(labid, expertise)) %>%
# #Creating plot
# ggplot(aes(x=labid, y= sizefrac_pct_recovery)) +
# theme_test() +
# geom_rect(ymin = 91.05, ymax = 108.95, xmin = 0, xmax = Inf, color = "gray87", fill = "gray87", alpha = 0.5)+
# geom_point(aes(color = as.factor(expertise), fill = as.factor(expertise)), alpha = 0.7, width = .05, size = 3) +
# geom_hline(yintercept = 100, linetype = "dotted")+
# stat_summary(fun="mean", geom="segment", mapping=aes(xend=..x.. - 0.25, yend=..y..))+
# stat_summary(fun="mean", geom="segment", mapping=aes(xend=..x.. + 0.25, yend=..y..))+
# facet_wrap(~sampletype_f, ncol = 3)+
# theme(text = element_text(size = 12),
# plot.title = element_text(hjust = 0.5),
# plot.subtitle = element_text(hjust = 0.5),
# legend.position = "right",
# axis.text.x = element_text(angle = 45, vjust = 1, hjust=1),
# axis.ticks.x = element_blank())+
# scale_fill_manual(values = c("royalblue", "darkcyan", "darkblue"))+
# scale_color_manual(values = c("royalblue", "darkcyan", "darkblue"))+
# expand_limits(y = 0) +
# labs(x = "Labs", y = "Recovery (%)", fill = "Experience", color = "Experience", title = "Microscopy", subtitle = "Particle Recovery, 212-500 µm", caption = "Points represent individual samples spiked with microplastic particles.\nDotted line and shaded area represent 100% recovery of polymer materials and RSD, respectively.\nNot blank corrected.")
#
# plot(f)
#
# #212-500 µm - Summary
# g <- Join_Microscopy_SizeFraction %>%
# filter(sampletype_f != "Dirty Water") %>%
# filter(plastic_f != "N") %>%
# #Data manipulation
# group_by(sampletype_f, labid, set, sampleid, microscopy_f, sizefraction_f, sizefrac_pct_recovery) %>%
# summarise() %>%
# group_by(sampletype_f, labid, sizefraction_f) %>%
# mutate(sizefrac_pct_recovery_mean = mean(sizefrac_pct_recovery)) %>%
# ungroup() %>%
# filter(sizefraction_f == "212-500 µm") %>%
# group_by(sampletype_f, labid, microscopy_f, sizefrac_pct_recovery_mean) %>%
# summarise() %>%
# #Creating plot
# ggplot(aes(x=microscopy_f, y= sizefrac_pct_recovery_mean)) +
# theme_test() +
# geom_rect(ymin = 91.05, ymax = 108.95, xmin = 0, xmax = Inf, color = "gray87", fill = "gray87", alpha = 0.5)+
# geom_point(aes(color = microscopy_f, fill = microscopy_f, alpha = 0.7), width = .05, size = 3) +
# geom_boxplot(alpha = 0.5,aes(color = microscopy_f, fill = microscopy_f), outlier.shape = NA) +
# geom_hline(yintercept = 100, linetype = "dotted")+
# facet_wrap(~sampletype_f, ncol = 3)+
# theme(text = element_text(size = 12),
# plot.title = element_text(hjust = 0.5),
# plot.subtitle = element_text(hjust = 0.5),
# legend.position = "none",
# axis.text.x = element_blank(),
# axis.title.x = element_blank(),
# axis.ticks.x = element_blank())+
# scale_color_manual(values = c("darkmagenta")) +
# scale_fill_manual(values = c("darkmagenta")) +
# expand_limits(y = 0) +
# labs(y = "Recovery (%)", fill = "Lab", title = "Microscopy", subtitle = "Particle Recovery, 212-500 µm", caption = "Points represent the sample mean (n = 1-3) of each laboratory.\nDotted line and shaded area represent 100% recovery of polymer materials and RSD, respectively.\nNot blank corrected.")
#
# plot(g)