R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

##This R markdown file, written by Savanna van Mesdag, details t-tests and Wilcoxon #Rank Sum tests carried out on substrate data collected on the Barrow-in-Furness slag #bank in 2021, to test for differnces between capped and uncapped (exposed slag) substrates.

#First to install the relevant packages…

#install.packages("tidyverse")
#install.packages("rstatix")
#install.packages("ggpubr")

#Then to load the packages…

library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.4.1
## Warning: package 'tidyr' was built under R version 4.4.1
## Warning: package 'readr' was built under R version 4.4.1
## Warning: package 'purrr' was built under R version 4.4.1
## Warning: package 'forcats' was built under R version 4.4.1
## Warning: package 'lubridate' was built under R version 4.4.1
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## āœ” dplyr     1.1.4     āœ” readr     2.1.5
## āœ” forcats   1.0.0     āœ” stringr   1.5.1
## āœ” ggplot2   3.5.1     āœ” tibble    3.2.1
## āœ” lubridate 1.9.3     āœ” tidyr     1.3.1
## āœ” purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## āœ– dplyr::filter() masks stats::filter()
## āœ– dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(rstatix)
## Warning: package 'rstatix' was built under R version 4.4.1
## 
## Attaching package: 'rstatix'
## 
## The following object is masked from 'package:stats':
## 
##     filter
library(ggpubr)
## Warning: package 'ggpubr' was built under R version 4.4.1

Loading the data… Make sure to set your directory beforehand as needed.

Barrow_Capped_Uncapped <- read.csv("CAPPED_AND_UNCAPPED_BARROW_1_MG_KG.csv")
print(Barrow_Capped_Uncapped)
##    Technique     pH      SiO2    Al2O3     Fe2O3       CaO       MgO     Na2O
## 1   Uncapped  9.921 143502.52 47579.61  8393.106 255144.60 18513.202 4302.770
## 2     Capped  8.850 221096.72 53189.66 27907.078  95053.87  8201.288 5415.555
## 3     Capped  7.701 215954.93 88649.43 53506.051  34876.91  7960.074 8308.797
## 4     Capped  8.295 260828.69 43292.68 22381.616  79688.02  6633.395 5934.855
## 5   Uncapped  8.363 188376.27 63774.67 25389.146 147226.30  7115.824 2893.242
## 6     Capped  8.047 284200.43 51760.68 31474.148  30874.64  9045.538 6602.526
## 7     Capped  9.841 265970.47 52342.86 29515.756  57389.67  9769.182 6528.341
## 8     Capped 10.294 246805.64 53983.53 25319.203  85762.89  8683.717 5341.370
## 9   Uncapped 10.797  92552.11 25774.49  4406.381 316608.01  6573.091 1409.528
## 10    Capped  9.019 251947.42 44404.10 27067.767  87549.62 10854.646 5712.298
## 11  Uncapped 10.774 129479.47 37735.55  7274.025 278729.40 11216.468 1706.271
##          K2O     Cr2O3      TiO2      MnO       P2O5       SrO       BaO   LOI
## 1   3569.635  20.52607 2936.7802 4491.853  599.92253 676.47564 3045.2147 16.55
## 2  15772.808  95.78834 3536.1231 1239.132 1399.81923 169.11891  626.9560 19.60
## 3  23161.123 191.57668 8031.1948 2710.601 3699.52226  84.55946  447.8257 15.80
## 4  14444.571  75.26227 3056.6488  619.566 1399.81923  84.55946  447.8257 15.80
## 5   8218.463  75.26227 2876.8459 2942.938 1499.80632 253.67837 3224.3449 18.60
## 6  16602.956 102.63036 3056.6488 1239.132 1599.79341  84.55946  806.0862 14.80
## 7  16353.911 102.63036 3056.6488 1239.132 1299.83214  84.55946 1343.4771 13.80
## 8  14444.571  82.10429 2936.7802 1394.023 1099.85797  84.55946  985.2165 15.90
## 9   2739.488  20.52607  719.2115 1626.361  199.97418 253.67837 2955.6495 27.20
## 10 12286.187  82.10429 2936.7802 2633.155 1099.85797 253.67837 2059.9981 14.95
## 11  3071.547  13.68405  958.9486 1936.144   99.98709 253.67837 5194.7779 19.70
##     Ag As  B   Be  Bi   Cd Co Cu Ga  Hg La Li  Mo Ni  Pb     S  Sb Sc Th Tl U
## 1  0.2  5 30 10.3 1.5 0.25  2 28  5 0.5 40 70 0.5  6  11  7000 1.5 15 10  5 5
## 2  0.2 15 20  2.1 1.5 0.25 11 44  5 0.5 20 30 1.0 29  61  1600 3.0  5 10  5 5
## 3  0.2 60 10  1.1 1.5 0.25 31 97  5 0.5 20 40 1.0 60  14   500 5.0 15 10  5 5
## 4  0.2 11 10  0.7 1.5 0.25  9 37  5 0.5 10 20 1.0 23  43   600 1.5  3 10  5 5
## 5  0.5  8 20  5.8 1.5 1.00  4 32  5 0.5 20 40 1.0 10 158  2400 5.0  5 10  5 5
## 6  0.7 12 10  1.5 1.5 1.80  9 41  5 1.0 10 20 1.0 24 240   900 5.0  3 10  5 5
## 7  0.4 10 20  2.5 1.5 0.90  7 39  5 1.0 20 30 1.0 24 124  2300 3.0  4 10  5 5
## 8  0.4 15 20  3.1 1.5 0.80  7 32  5 0.5 20 30 1.0 20 118  2400 5.0  5 10  5 5
## 9  0.3  5 50  6.3 1.5 0.25  1 19  5 0.5 30 40 0.5  4  27  5800 1.5  7 10  5 5
## 10 0.8 12 20  4.5 1.5 1.50  6 42  5 2.0 20 40 1.0 18 211  3300 6.0  5 10  5 5
## 11 0.3  4 60  9.1 1.5 0.25  2 23  5 0.5 30 60 0.5  4  28 11800 1.5 10 10  5 5
##     V W  Zn Albite Aluminium.oxide.hydroxide Aragonite Calcite Clinochlore
## 1  18 5  24      0                         0         0       1           0
## 2  25 5  88      0                         0         0       1           0
## 3  39 5  57      1                         0         0       1           1
## 4  21 5  68      0                         1         0       1           0
## 5  11 5 210      0                         0         0       1           0
## 6  23 5 544      0                         0         0       0           0
## 7  26 5 215      0                         0         0       0           0
## 8  20 5 202      0                         0         0       1           0
## 9   7 5  46      0                         0         0       1           0
## 10 23 5 399      0                         0         1       0           0
## 11  5 5  51      0                         0         0       1           0
##    Diaspore Gehlenite Illite Kaolinite Melilite Microcline Mullite Muscovite
## 1         0         1      0         0        1          0       0         0
## 2         0         0      0         1        0          0       0        10
## 3         0         0      1         0        0          0       0         1
## 4         0         0      0         1        0          0       0         1
## 5         1         1      0         1        0          0       1         0
## 6         0         0      0         1        0          0       0         1
## 7         0         0      0         1        0          1       0         1
## 8         0         0      0         0        0          0       0         0
## 9         0         0      0         0        0          0       0         0
## 10        0         0      0         0        0          0       0         0
## 11        0         1      0         0        1          0       0         1
##    Periclase Phengite Quartz
## 1          0        0      0
## 2          0        0      1
## 3          0        0      1
## 4          1        0      1
## 5          0        0      1
## 6          0        0      1
## 7          0        0      1
## 8          0        1      1
## 9          0        0      1
## 10         0        0      1
## 11         0        0      0
Barrow_Capped_Uncapped_na <- na.omit(Barrow_Capped_Uncapped)

#Before carrying out tests, it is useful to look at histograms of the data to establish #normality. Normally distributed data can be tested using the two-sample t-test, while #data that are not normally distributed ought to undergo Wilcoxon rank sum tests instead.

hist(Barrow_Capped_Uncapped_na$SiO2)

#From this histogram, it can be seen that SiO2 has a non-normal distribution. Therefore, #a Wilcoxon test, rather than a t test, will be carried out for SiO2 in the uncapped and #capped substrates.

SiO2Wilcox <- wilcox.test(Barrow_Capped_Uncapped_na[,3] ~ Barrow_Capped_Uncapped_na[,1])
print(SiO2Wilcox) 
## 
##  Wilcoxon rank sum exact test
## 
## data:  Barrow_Capped_Uncapped_na[, 3] by Barrow_Capped_Uncapped_na[, 1]
## W = 28, p-value = 0.006061
## alternative hypothesis: true location shift is not equal to 0

#A quick t-test for the data just to obtain the means more quickly and efficiently…

Capping_t_test_SiO2 <- t.test(Barrow_Capped_Uncapped_na[,3] ~ Barrow_Capped_Uncapped_na[,1])

print(Capping_t_test_SiO2)
## 
##  Welch Two Sample t-test
## 
## data:  Barrow_Capped_Uncapped_na[, 3] by Barrow_Capped_Uncapped_na[, 1]
## t = 5.0875, df = 4.3318, p-value = 0.00568
## alternative hypothesis: true difference in means between group Capped and group Uncapped is not equal to 0
## 95 percent confidence interval:
##   52240.25 169891.51
## sample estimates:
##   mean in group Capped mean in group Uncapped 
##               249543.5               138477.6

#The Wilcoxon test demonstrates that there are significant differences between SiO2 on #capped and uncapped parts of the slag bank. SiO2 was recorded in significantly higher #levels on capped substrates on-site.

hist(Barrow_Capped_Uncapped_na$pH)

#Non-normal distribution, will do a Wilcoxon rank sum test…

pHWilcox <- wilcox.test(Barrow_Capped_Uncapped_na[,2] ~ Barrow_Capped_Uncapped_na[,1])
print(pHWilcox)
## 
##  Wilcoxon rank sum exact test
## 
## data:  Barrow_Capped_Uncapped_na[, 2] by Barrow_Capped_Uncapped_na[, 1]
## W = 5, p-value = 0.1091
## alternative hypothesis: true location shift is not equal to 0

#No significant differences

hist(Barrow_Capped_Uncapped_na$Al2O3)

#Will do a Wilcoxon test for Al2O3 as well, non-normal distribution.

Al2O3Wilcox <-wilcox.test(Barrow_Capped_Uncapped_na[,4] ~ Barrow_Capped_Uncapped_na[,1])

print(Al2O3Wilcox)
## 
##  Wilcoxon rank sum exact test
## 
## data:  Barrow_Capped_Uncapped_na[, 4] by Barrow_Capped_Uncapped_na[, 1]
## W = 20, p-value = 0.3152
## alternative hypothesis: true location shift is not equal to 0

#No significant differences

hist(Barrow_Capped_Uncapped_na$Fe2O3)

#Will do a Wilcoxon test for Fe2O3, non-normal distribution.

Fe2O3Wilcox <-wilcox.test(Barrow_Capped_Uncapped_na[,5] ~ Barrow_Capped_Uncapped_na[,1])
print(Fe2O3Wilcox)
## 
##  Wilcoxon rank sum exact test
## 
## data:  Barrow_Capped_Uncapped_na[, 5] by Barrow_Capped_Uncapped_na[, 1]
## W = 26, p-value = 0.02424
## alternative hypothesis: true location shift is not equal to 0

#A quick t-test for the data just to obtain the means more quickly and efficiently…

Capping_t_test_Fe2O3 <- t.test(Barrow_Capped_Uncapped_na[,5] ~ Barrow_Capped_Uncapped_na[,1])

print(Capping_t_test_Fe2O3)
## 
##  Welch Two Sample t-test
## 
## data:  Barrow_Capped_Uncapped_na[, 5] by Barrow_Capped_Uncapped_na[, 1]
## t = 3.1973, df = 6.8602, p-value = 0.01554
## alternative hypothesis: true difference in means between group Capped and group Uncapped is not equal to 0
## 95 percent confidence interval:
##   5059.266 34258.439
## sample estimates:
##   mean in group Capped mean in group Uncapped 
##               31024.52               11365.66

#The Wilcoxon test demonstrates that there are significant differences between Fe2O3 on #capped and uncapped parts of the slag bank. Fe2O3 was recorded in significantly higher #levels on capped substrates on-site.

hist(Barrow_Capped_Uncapped_na$CaO)

#Again, a non-normal distribution, so time for another Wilcoxon rank sum test…

CaOWilcox <-wilcox.test(Barrow_Capped_Uncapped_na[,6] ~ Barrow_Capped_Uncapped_na[,1])

print(CaOWilcox)
## 
##  Wilcoxon rank sum exact test
## 
## data:  Barrow_Capped_Uncapped_na[, 6] by Barrow_Capped_Uncapped_na[, 1]
## W = 0, p-value = 0.006061
## alternative hypothesis: true location shift is not equal to 0

#A quick t-test for the data just to obtain the means…

Capping_t_test_CaO <- t.test(Barrow_Capped_Uncapped_na[,6] ~ Barrow_Capped_Uncapped_na[,1])

print(Capping_t_test_CaO)
## 
##  Welch Two Sample t-test
## 
## data:  Barrow_Capped_Uncapped_na[, 6] by Barrow_Capped_Uncapped_na[, 1]
## t = -4.8334, df = 3.4561, p-value = 0.0121
## alternative hypothesis: true difference in means between group Capped and group Uncapped is not equal to 0
## 95 percent confidence interval:
##  -293548.3  -70678.5
## sample estimates:
##   mean in group Capped mean in group Uncapped 
##               67313.66              249427.08

#The Wilcoxon test demonstrates that there are significant differences between CaO on #capped and uncapped parts of the slag bank. CaO was recorded in significantly higher #levels on uncapped substrates on-site.

hist(Barrow_Capped_Uncapped_na$MgO)

#Again, a non-normal distribution, so time for another Wilcoxon rank sum test…

MgOWilcox <-wilcox.test(Barrow_Capped_Uncapped_na[,7] ~ Barrow_Capped_Uncapped_na[,1])

print(MgOWilcox)
## 
##  Wilcoxon rank sum exact test
## 
## data:  Barrow_Capped_Uncapped_na[, 7] by Barrow_Capped_Uncapped_na[, 1]
## W = 13, p-value = 0.9273
## alternative hypothesis: true location shift is not equal to 0

#No significant differences.

hist(Barrow_Capped_Uncapped_na$Na2O)

#This shows more of a normal distribution, so a t-test can be done for this one.

Capping_t_test_Na2O <- t.test(Barrow_Capped_Uncapped_na[,8] ~ Barrow_Capped_Uncapped_na[,1])

print(Capping_t_test_Na2O)
## 
##  Welch Two Sample t-test
## 
## data:  Barrow_Capped_Uncapped_na[, 8] by Barrow_Capped_Uncapped_na[, 1]
## t = 4.8207, df = 5.1455, p-value = 0.004445
## alternative hypothesis: true difference in means between group Capped and group Uncapped is not equal to 0
## 95 percent confidence interval:
##  1736.815 5634.063
## sample estimates:
##   mean in group Capped mean in group Uncapped 
##               6263.392               2577.953

#From the t-test, it can be seen that Na2O is significantly lower in uncapped than #capped substrates on the Barrow slag bank.

hist(Barrow_Capped_Uncapped_na$K2O)

#Another non-normal distribution, so will do another Wilcoxon rank sum test.

K2OWilcox <-wilcox.test(Barrow_Capped_Uncapped_na[,9] ~ Barrow_Capped_Uncapped_na[,1])
## Warning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot
## compute exact p-value with ties
print(K2OWilcox)
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  Barrow_Capped_Uncapped_na[, 9] by Barrow_Capped_Uncapped_na[, 1]
## W = 28, p-value = 0.01056
## alternative hypothesis: true location shift is not equal to 0

#A quick t-test for the data just to obtain the means…

Capping_t_test_K2O <- t.test(Barrow_Capped_Uncapped_na[,9] ~ Barrow_Capped_Uncapped_na[,1])

print(Capping_t_test_K2O)
## 
##  Welch Two Sample t-test
## 
## data:  Barrow_Capped_Uncapped_na[, 9] by Barrow_Capped_Uncapped_na[, 1]
## t = 6.4472, df = 8.0387, p-value = 0.0001948
## alternative hypothesis: true difference in means between group Capped and group Uncapped is not equal to 0
## 95 percent confidence interval:
##   7552.434 15952.608
## sample estimates:
##   mean in group Capped mean in group Uncapped 
##              16152.304               4399.783

#K2O is present in significantly higher concentrations in uncapped parts of the Barrow slag #bank.

hist(Barrow_Capped_Uncapped_na$Cr2O3)

#Non-normal distribution.

Cr2O3Wilcox <-wilcox.test(Barrow_Capped_Uncapped_na[,10] ~ Barrow_Capped_Uncapped_na[,1])
## Warning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot
## compute exact p-value with ties
print(Cr2O3Wilcox)
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  Barrow_Capped_Uncapped_na[, 10] by Barrow_Capped_Uncapped_na[, 1]
## W = 27.5, p-value = 0.01316
## alternative hypothesis: true location shift is not equal to 0

#A quick t-test for the data just to obtain the means…

Capping_t_test_Cr2O3 <- t.test(Barrow_Capped_Uncapped_na[,10] ~ Barrow_Capped_Uncapped_na[,1])

print(Capping_t_test_Cr2O3)
## 
##  Welch Two Sample t-test
## 
## data:  Barrow_Capped_Uncapped_na[, 10] by Barrow_Capped_Uncapped_na[, 1]
## t = 3.4661, df = 8.247, p-value = 0.008102
## alternative hypothesis: true difference in means between group Capped and group Uncapped is not equal to 0
## 95 percent confidence interval:
##   24.3760 119.7952
## sample estimates:
##   mean in group Capped mean in group Uncapped 
##              104.58523               32.49962

#Cr2O3 levels are significantly higher in capped substrates on the Barrow slag bank.

hist(Barrow_Capped_Uncapped_na$TiO2)

#Non-normal distribution

TiO2Wilcox <-wilcox.test(Barrow_Capped_Uncapped_na[,11] ~ Barrow_Capped_Uncapped_na[,1])
## Warning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot
## compute exact p-value with ties
print(TiO2Wilcox)
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  Barrow_Capped_Uncapped_na[, 11] by Barrow_Capped_Uncapped_na[, 1]
## W = 27, p-value = 0.01611
## alternative hypothesis: true location shift is not equal to 0

#T-test for means…

Capping_t_test_TiO2 <- t.test(Barrow_Capped_Uncapped_na[,11] ~ Barrow_Capped_Uncapped_na[,1])
print(Capping_t_test_TiO2)
## 
##  Welch Two Sample t-test
## 
## data:  Barrow_Capped_Uncapped_na[, 11] by Barrow_Capped_Uncapped_na[, 1]
## t = 2.0776, df = 8.7288, p-value = 0.06848
## alternative hypothesis: true difference in means between group Capped and group Uncapped is not equal to 0
## 95 percent confidence interval:
##  -181.3105 4038.5102
## sample estimates:
##   mean in group Capped mean in group Uncapped 
##               3801.546               1872.947

#TiO2 levels are significantly higher in capped substrates on the Barrow slag bank.

hist(Barrow_Capped_Uncapped_na$MnO)

#Non-normal distribution

MnOWilcox <-wilcox.test(Barrow_Capped_Uncapped_na[,12] ~ Barrow_Capped_Uncapped_na[,1])
## Warning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot
## compute exact p-value with ties
print(MnOWilcox)
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  Barrow_Capped_Uncapped_na[, 12] by Barrow_Capped_Uncapped_na[, 1]
## W = 4, p-value = 0.07
## alternative hypothesis: true location shift is not equal to 0

#No significant differences.

hist(Barrow_Capped_Uncapped_na$P2O5)

#Non-normal distribution

P2O5Wilcox <-wilcox.test(Barrow_Capped_Uncapped_na[,13] ~ Barrow_Capped_Uncapped_na[,1])
## Warning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot
## compute exact p-value with ties
print(P2O5Wilcox)
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  Barrow_Capped_Uncapped_na[, 13] by Barrow_Capped_Uncapped_na[, 1]
## W = 23, p-value = 0.1066
## alternative hypothesis: true location shift is not equal to 0

#No significant differences

hist(Barrow_Capped_Uncapped_na$SrO)

#Non-normal distribution

SrOWilcox <-wilcox.test(Barrow_Capped_Uncapped_na[,14] ~ Barrow_Capped_Uncapped_na[,1])
## Warning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot
## compute exact p-value with ties
print(SrOWilcox)
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  Barrow_Capped_Uncapped_na[, 14] by Barrow_Capped_Uncapped_na[, 1]
## W = 1.5, p-value = 0.01468
## alternative hypothesis: true location shift is not equal to 0

#T-test for means…

Capping_t_test_SrO <- t.test(Barrow_Capped_Uncapped_na[,14] ~ Barrow_Capped_Uncapped_na[,1])
print(Capping_t_test_SrO)
## 
##  Welch Two Sample t-test
## 
## data:  Barrow_Capped_Uncapped_na[, 14] by Barrow_Capped_Uncapped_na[, 1]
## t = -2.1959, df = 3.3438, p-value = 0.1064
## alternative hypothesis: true difference in means between group Capped and group Uncapped is not equal to 0
## 95 percent confidence interval:
##  -565.07969   87.92277
## sample estimates:
##   mean in group Capped mean in group Uncapped 
##               120.7992               359.3777

#SrO levels are significantly higher in uncapped substrates on the Barrow slag bank.

hist(Barrow_Capped_Uncapped_na$BaO)

#Non-normal distribution

BaOWilcox <-wilcox.test(Barrow_Capped_Uncapped_na[,15] ~ Barrow_Capped_Uncapped_na[,1])
## Warning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot
## compute exact p-value with ties
print(BaOWilcox)
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  Barrow_Capped_Uncapped_na[, 15] by Barrow_Capped_Uncapped_na[, 1]
## W = 0, p-value = 0.01056
## alternative hypothesis: true location shift is not equal to 0

#T-test for means…

Capping_t_test_BaO <- t.test(Barrow_Capped_Uncapped_na[,15] ~ Barrow_Capped_Uncapped_na[,1])
print(Capping_t_test_BaO)
## 
##  Welch Two Sample t-test
## 
## data:  Barrow_Capped_Uncapped_na[, 15] by Barrow_Capped_Uncapped_na[, 1]
## t = -4.5914, df = 4.0428, p-value = 0.009846
## alternative hypothesis: true difference in means between group Capped and group Uncapped is not equal to 0
## 95 percent confidence interval:
##  -4238.407 -1052.333
## sample estimates:
##   mean in group Capped mean in group Uncapped 
##               959.6265              3604.9968

#BaO levels are significantly higher in uncapped parts of the Barrow slag bank.

hist(Barrow_Capped_Uncapped$LOI)

#Non-normal distribution

LOIWilcox <-wilcox.test(Barrow_Capped_Uncapped_na[,16] ~ Barrow_Capped_Uncapped_na[,1])
## Warning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot
## compute exact p-value with ties
print(LOIWilcox)
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  Barrow_Capped_Uncapped_na[, 16] by Barrow_Capped_Uncapped_na[, 1]
## W = 2, p-value = 0.02939
## alternative hypothesis: true location shift is not equal to 0

#T-test for means…

Capping_t_test_LOI <- t.test(Barrow_Capped_Uncapped_na[,16] ~ Barrow_Capped_Uncapped_na[,1])
print(Capping_t_test_LOI)
## 
##  Welch Two Sample t-test
## 
## data:  Barrow_Capped_Uncapped_na[, 16] by Barrow_Capped_Uncapped_na[, 1]
## t = -1.9412, df = 3.5439, p-value = 0.1333
## alternative hypothesis: true difference in means between group Capped and group Uncapped is not equal to 0
## 95 percent confidence interval:
##  -11.791047   2.380333
## sample estimates:
##   mean in group Capped mean in group Uncapped 
##               15.80714               20.51250

#LOI is significantly higher in uncapped parts of the Barrow slag bank.

hist(Barrow_Capped_Uncapped_na$Ag)

#Non-normal distribution

AgWilcox <-wilcox.test(Barrow_Capped_Uncapped_na[,17] ~ Barrow_Capped_Uncapped_na[,1])
## Warning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot
## compute exact p-value with ties
print(AgWilcox)
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  Barrow_Capped_Uncapped_na[, 17] by Barrow_Capped_Uncapped_na[, 1]
## W = 15.5, p-value = 0.8459
## alternative hypothesis: true location shift is not equal to 0

#No significant differences

hist(Barrow_Capped_Uncapped_na$As)

#Non-normal distribution

AsWilcox <-wilcox.test(Barrow_Capped_Uncapped_na[,18] ~ Barrow_Capped_Uncapped_na[,1])
## Warning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot
## compute exact p-value with ties
print(AsWilcox)
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  Barrow_Capped_Uncapped_na[, 18] by Barrow_Capped_Uncapped_na[, 1]
## W = 28, p-value = 0.0102
## alternative hypothesis: true location shift is not equal to 0

#T-test for means.

Capping_t_test_As <- t.test(Barrow_Capped_Uncapped_na[,18] ~ Barrow_Capped_Uncapped_na[,1])
print(Capping_t_test_As)
## 
##  Welch Two Sample t-test
## 
## data:  Barrow_Capped_Uncapped_na[, 18] by Barrow_Capped_Uncapped_na[, 1]
## t = 2.0043, df = 6.1917, p-value = 0.0904
## alternative hypothesis: true difference in means between group Capped and group Uncapped is not equal to 0
## 95 percent confidence interval:
##  -2.918837 30.490266
## sample estimates:
##   mean in group Capped mean in group Uncapped 
##               19.28571                5.50000

#Significantly higher levels of As on capped substrates on the Barrow slag bank.

hist(Barrow_Capped_Uncapped_na$B)

#Non-normal distribution.

BWilcoxB <-wilcox.test(Barrow_Capped_Uncapped_na[,19] ~ Barrow_Capped_Uncapped_na[,1])
## Warning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot
## compute exact p-value with ties
print(BWilcoxB)
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  Barrow_Capped_Uncapped_na[, 19] by Barrow_Capped_Uncapped_na[, 1]
## W = 2, p-value = 0.02131
## alternative hypothesis: true location shift is not equal to 0

#T-test for means…

Capping_t_test_B <- t.test(Barrow_Capped_Uncapped_na[,19] ~ Barrow_Capped_Uncapped_na[,1])
print(Capping_t_test_B)
## 
##  Welch Two Sample t-test
## 
## data:  Barrow_Capped_Uncapped_na[, 19] by Barrow_Capped_Uncapped_na[, 1]
## t = -2.5975, df = 3.2971, p-value = 0.07315
## alternative hypothesis: true difference in means between group Capped and group Uncapped is not equal to 0
## 95 percent confidence interval:
##  -52.579461   4.008032
## sample estimates:
##   mean in group Capped mean in group Uncapped 
##               15.71429               40.00000

#B conc is significantly higher in the uncapped substrates on the Barrow slag bank.

hist(Barrow_Capped_Uncapped_na$Be)

#Non-normal distribution

BeWilcox <-wilcox.test(Barrow_Capped_Uncapped_na[,20] ~ Barrow_Capped_Uncapped_na[,1])
print(BeWilcox)
## 
##  Wilcoxon rank sum exact test
## 
## data:  Barrow_Capped_Uncapped_na[, 20] by Barrow_Capped_Uncapped_na[, 1]
## W = 0, p-value = 0.006061
## alternative hypothesis: true location shift is not equal to 0

#T-test for means

Capping_t_test_Be <- t.test(Barrow_Capped_Uncapped_na[,20] ~ Barrow_Capped_Uncapped_na[,1])
print(Capping_t_test_Be)
## 
##  Welch Two Sample t-test
## 
## data:  Barrow_Capped_Uncapped_na[, 20] by Barrow_Capped_Uncapped_na[, 1]
## t = -4.7466, df = 4.2643, p-value = 0.007675
## alternative hypothesis: true difference in means between group Capped and group Uncapped is not equal to 0
## 95 percent confidence interval:
##  -8.892461 -2.428967
## sample estimates:
##   mean in group Capped mean in group Uncapped 
##               2.214286               7.875000

#Be levels are significantly higher in uncapped substrates on the Barrow slag bank.

#Skipping Bi because recorded values are the same in each sample.

hist(Barrow_Capped_Uncapped_na$Cd)

#Non-normal distribution

CdWilcox <-wilcox.test(Barrow_Capped_Uncapped_na[,22] ~ Barrow_Capped_Uncapped_na[,1])
## Warning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot
## compute exact p-value with ties
print(CdWilcox)
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  Barrow_Capped_Uncapped_na[, 22] by Barrow_Capped_Uncapped_na[, 1]
## W = 18.5, p-value = 0.4097
## alternative hypothesis: true location shift is not equal to 0

#No significant differences

hist(Barrow_Capped_Uncapped_na$Co)

#Non-normal distribution

CoWilcox <-wilcox.test(Barrow_Capped_Uncapped_na[,23] ~ Barrow_Capped_Uncapped_na[,1])
## Warning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot
## compute exact p-value with ties
print(CoWilcox)
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  Barrow_Capped_Uncapped_na[, 23] by Barrow_Capped_Uncapped_na[, 1]
## W = 28, p-value = 0.0102
## alternative hypothesis: true location shift is not equal to 0

#T-test for means.

Capping_t_test_Co <- t.test(Barrow_Capped_Uncapped_na[,23] ~ Barrow_Capped_Uncapped_na[,1])
print(Capping_t_test_Co)
## 
##  Welch Two Sample t-test
## 
## data:  Barrow_Capped_Uncapped_na[, 23] by Barrow_Capped_Uncapped_na[, 1]
## t = 2.7141, df = 6.4214, p-value = 0.03264
## alternative hypothesis: true difference in means between group Capped and group Uncapped is not equal to 0
## 95 percent confidence interval:
##   1.033453 17.323690
## sample estimates:
##   mean in group Capped mean in group Uncapped 
##               11.42857                2.25000

#Co levels are significantly higher in capped substrates on the Barrow slag bank.

hist(Barrow_Capped_Uncapped_na$Cu)

#Non-normal distribution

CuWilcox <-wilcox.test(Barrow_Capped_Uncapped_na[,24] ~ Barrow_Capped_Uncapped_na[,1])
## Warning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot
## compute exact p-value with ties
print(CuWilcox)
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  Barrow_Capped_Uncapped_na[, 24] by Barrow_Capped_Uncapped_na[, 1]
## W = 27.5, p-value = 0.0138
## alternative hypothesis: true location shift is not equal to 0

#T test for means…

Capping_t_test_Cu <- t.test(Barrow_Capped_Uncapped_na[,24] ~ Barrow_Capped_Uncapped_na[,1])
print(Capping_t_test_Cu)
## 
##  Welch Two Sample t-test
## 
## data:  Barrow_Capped_Uncapped_na[, 24] by Barrow_Capped_Uncapped_na[, 1]
## t = 2.4749, df = 7.265, p-value = 0.04132
## alternative hypothesis: true difference in means between group Capped and group Uncapped is not equal to 0
## 95 percent confidence interval:
##   1.131213 42.725930
## sample estimates:
##   mean in group Capped mean in group Uncapped 
##               47.42857               25.50000

#Cu is significantly higher in capped substrates on the Barrow slag bank.

#Skipping Ga because recorded values are the same in each sample.

hist(Barrow_Capped_Uncapped_na$Hg)

#Non-normal distribution

HgWilcox <-wilcox.test(Barrow_Capped_Uncapped_na[,26] ~ Barrow_Capped_Uncapped_na[,1])
## Warning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot
## compute exact p-value with ties
print(HgWilcox)
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  Barrow_Capped_Uncapped_na[, 26] by Barrow_Capped_Uncapped_na[, 1]
## W = 20, p-value = 0.1846
## alternative hypothesis: true location shift is not equal to 0

#No significant differences.

hist(Barrow_Capped_Uncapped_na$La)

#Non-normal distribution

LaWilcox <-wilcox.test(Barrow_Capped_Uncapped_na[,27] ~ Barrow_Capped_Uncapped_na[,1])
## Warning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot
## compute exact p-value with ties
print(LaWilcox)
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  Barrow_Capped_Uncapped_na[, 27] by Barrow_Capped_Uncapped_na[, 1]
## W = 2.5, p-value = 0.02265
## alternative hypothesis: true location shift is not equal to 0

#Will do a t-test for means.

Capping_t_test_La <- t.test(Barrow_Capped_Uncapped_na[,27] ~ Barrow_Capped_Uncapped_na[,1])
print(Capping_t_test_La)
## 
##  Welch Two Sample t-test
## 
## data:  Barrow_Capped_Uncapped_na[, 27] by Barrow_Capped_Uncapped_na[, 1]
## t = -2.8701, df = 4.2607, p-value = 0.04219
## alternative hypothesis: true difference in means between group Capped and group Uncapped is not equal to 0
## 95 percent confidence interval:
##  -25.0004094  -0.7138763
## sample estimates:
##   mean in group Capped mean in group Uncapped 
##               17.14286               30.00000

#La levels are significantly higher in uncapped substrates on the Barrow slag bank.

hist(Barrow_Capped_Uncapped_na$Li)

#Non-normal distribution

LiWilcox <-wilcox.test(Barrow_Capped_Uncapped_na[,28] ~ Barrow_Capped_Uncapped_na[,1])
## Warning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot
## compute exact p-value with ties
print(LiWilcox)
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  Barrow_Capped_Uncapped_na[, 28] by Barrow_Capped_Uncapped_na[, 1]
## W = 2, p-value = 0.02436
## alternative hypothesis: true location shift is not equal to 0

#T-test for means…

Capping_t_test_Li <- t.test(Barrow_Capped_Uncapped_na[,28] ~ Barrow_Capped_Uncapped_na[,1])
print(Capping_t_test_Li)
## 
##  Welch Two Sample t-test
## 
## data:  Barrow_Capped_Uncapped_na[, 28] by Barrow_Capped_Uncapped_na[, 1]
## t = -2.7743, df = 4.0439, p-value = 0.0495
## alternative hypothesis: true difference in means between group Capped and group Uncapped is not equal to 0
## 95 percent confidence interval:
##  -44.92116324  -0.07883676
## sample estimates:
##   mean in group Capped mean in group Uncapped 
##                   30.0                   52.5

#Li levels are significantly higher on uncapped parts of the Barrow slag bank.

#Skipping Mo because of similarities of values.

hist(Barrow_Capped_Uncapped_na$Ni)

#Non-normal distribution

NiWilcox <-wilcox.test(Barrow_Capped_Uncapped_na[,30] ~ Barrow_Capped_Uncapped_na[,1])
## Warning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot
## compute exact p-value with ties
print(NiWilcox)
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  Barrow_Capped_Uncapped_na[, 30] by Barrow_Capped_Uncapped_na[, 1]
## W = 28, p-value = 0.01038
## alternative hypothesis: true location shift is not equal to 0

#T test for means…

Capping_t_test_Ni <- t.test(Barrow_Capped_Uncapped_na[,30] ~ Barrow_Capped_Uncapped_na[,1])
print(Capping_t_test_Ni)
## 
##  Welch Two Sample t-test
## 
## data:  Barrow_Capped_Uncapped_na[, 30] by Barrow_Capped_Uncapped_na[, 1]
## t = 3.9611, df = 6.775, p-value = 0.005825
## alternative hypothesis: true difference in means between group Capped and group Uncapped is not equal to 0
## 95 percent confidence interval:
##   8.892005 35.679424
## sample estimates:
##   mean in group Capped mean in group Uncapped 
##               28.28571                6.00000

#Ni levels are significantly higher in capped substrates on the Barrow slag bank.

hist(Barrow_Capped_Uncapped_na$Pb)

#Non-normal distribution.

PbWilcox <-wilcox.test(Barrow_Capped_Uncapped_na[,31] ~ Barrow_Capped_Uncapped_na[,1])
print(PbWilcox)
## 
##  Wilcoxon rank sum exact test
## 
## data:  Barrow_Capped_Uncapped_na[, 31] by Barrow_Capped_Uncapped_na[, 1]
## W = 21, p-value = 0.2303
## alternative hypothesis: true location shift is not equal to 0

#No significant differences

hist(Barrow_Capped_Uncapped_na$S)

#Non-normal distribution

SWilcox <-wilcox.test(Barrow_Capped_Uncapped_na[,32] ~ Barrow_Capped_Uncapped_na[,1])
## Warning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot
## compute exact p-value with ties
print(SWilcox)
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  Barrow_Capped_Uncapped_na[, 32] by Barrow_Capped_Uncapped_na[, 1]
## W = 1.5, p-value = 0.02303
## alternative hypothesis: true location shift is not equal to 0

#T test for means…

Capping_t_test_S <- t.test(Barrow_Capped_Uncapped_na[,32] ~ Barrow_Capped_Uncapped_na[,1])
print(Capping_t_test_S)
## 
##  Welch Two Sample t-test
## 
## data:  Barrow_Capped_Uncapped_na[, 32] by Barrow_Capped_Uncapped_na[, 1]
## t = -2.5651, df = 3.2554, p-value = 0.07635
## alternative hypothesis: true difference in means between group Capped and group Uncapped is not equal to 0
## 95 percent confidence interval:
##  -11140.0362    954.3219
## sample estimates:
##   mean in group Capped mean in group Uncapped 
##               1657.143               6750.000

#S levels are significantly higher on the uncapped parts of the Barrow slag bank.

hist(Barrow_Capped_Uncapped_na$Sb)

#Non-normal distribution

SbWilcox <-wilcox.test(Barrow_Capped_Uncapped_na[,33] ~ Barrow_Capped_Uncapped_na[,1])
## Warning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot
## compute exact p-value with ties
print(SbWilcox)
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  Barrow_Capped_Uncapped_na[, 33] by Barrow_Capped_Uncapped_na[, 1]
## W = 22, p-value = 0.1362
## alternative hypothesis: true location shift is not equal to 0

#No significant differences

hist(Barrow_Capped_Uncapped_na$Sc)

#Non-normal distribution

ScWilcox <-wilcox.test(Barrow_Capped_Uncapped_na[,34] ~ Barrow_Capped_Uncapped_na[,1])
## Warning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot
## compute exact p-value with ties
print(ScWilcox)
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  Barrow_Capped_Uncapped_na[, 34] by Barrow_Capped_Uncapped_na[, 1]
## W = 5, p-value = 0.09853
## alternative hypothesis: true location shift is not equal to 0

#No significant differences

#Skipping Th, Tl and U because of similar concentrations between samples.

hist(Barrow_Capped_Uncapped_na$V)

#Close to a normal distribution, will do a t test for this one…

Capping_t_test_V <- t.test(Barrow_Capped_Uncapped_na[,38] ~ Barrow_Capped_Uncapped_na[,1])
print(Capping_t_test_V)
## 
##  Welch Two Sample t-test
## 
## data:  Barrow_Capped_Uncapped_na[, 38] by Barrow_Capped_Uncapped_na[, 1]
## t = 4.0081, df = 7.0068, p-value = 0.005127
## alternative hypothesis: true difference in means between group Capped and group Uncapped is not equal to 0
## 95 percent confidence interval:
##   6.166895 23.904533
## sample estimates:
##   mean in group Capped mean in group Uncapped 
##               25.28571               10.25000

#V levels are significantly higher in capped parts of the Barrow slag bank.

#Skipping W as all samples had the same concentration.

hist(Barrow_Capped_Uncapped_na$Zn)

#Non-normal distribution

ZnWilcox <-wilcox.test(Barrow_Capped_Uncapped_na[,40] ~ Barrow_Capped_Uncapped_na[,1])
print(ZnWilcox)
## 
##  Wilcoxon rank sum exact test
## 
## data:  Barrow_Capped_Uncapped_na[, 40] by Barrow_Capped_Uncapped_na[, 1]
## W = 24, p-value = 0.07273
## alternative hypothesis: true location shift is not equal to 0

#No significant differences.