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 file details various calculations that were performed on the Barrow data, in addition #to those covered in additional files.

#First, install relevant packages

#install.packages(ggplot2)

#Load packages…

library(ggplot2)

#Loading the relevant data to be used… Make sure to set the working directory beforehand.

BarrowGeochemData <- read.csv("BARROW_PLANT_CHEMISTRY_MG_KG.csv",  
                        header = TRUE)

Barrow_Diversity <- read.csv("Barrow_Diversity_Indices.csv")

Capped_and_Uncapped_Barrow_pH <- read.csv("Capped_and_Uncapped_Barrow_pH.csv",
                                          header = TRUE)

#Having a quick look at some of the data…

head(BarrowGeochemData)
##   pH_level     SiO2    Al2O3     Fe2O3       CaO       MgO     Na2O       K2O
## 1    9.921 143502.5 47579.61  8393.106 255144.60 18513.202 4302.770  3569.635
## 2    8.850 221096.7 53189.66 27907.078  95053.87  8201.288 5415.555 15772.808
## 3    7.701 215954.9 88649.43 53506.051  34876.91  7960.074 8308.797 23161.123
## 4    8.295 260828.7 43292.68 22381.616  79688.02  6633.395 5934.855 14444.571
## 5    8.363 188376.3 63774.67 25389.146 147226.30  7115.824 2893.242  8218.463
## 6    8.047 284200.4 51760.68 31474.148  30874.64  9045.538 6602.526 16602.956
##       Cr2O3     TiO2      MnO      P2O5       SrO       BaO   LOI  Ag As  B
## 1  20.52607 2936.780 4491.853  599.9225 676.47564 3045.2147 16.55 0.2  5 30
## 2  95.78834 3536.123 1239.132 1399.8192 169.11891  626.9560 19.60 0.2 15 20
## 3 191.57668 8031.195 2710.601 3699.5223  84.55946  447.8257 15.80 0.2 60 10
## 4  75.26227 3056.649  619.566 1399.8192  84.55946  447.8257 15.80 0.2 11 10
## 5  75.26227 2876.846 2942.938 1499.8063 253.67837 3224.3449 18.60 0.5  8 20
## 6 102.63036 3056.649 1239.132 1599.7934  84.55946  806.0862 14.80 0.7 12 10
##     Be  Bi   Cd Co Cu Ga  Hg La Li  Mo Ni  Pb    S  Sb Sc Th Tl U  V W  Zn
## 1 10.3 1.5 0.25  2 28  5 0.5 40 70 0.5  6  11 7000 1.5 15 10  5 5 18 5  24
## 2  2.1 1.5 0.25 11 44  5 0.5 20 30 1.0 29  61 1600 3.0  5 10  5 5 25 5  88
## 3  1.1 1.5 0.25 31 97  5 0.5 20 40 1.0 60  14  500 5.0 15 10  5 5 39 5  57
## 4  0.7 1.5 0.25  9 37  5 0.5 10 20 1.0 23  43  600 1.5  3 10  5 5 21 5  68
## 5  5.8 1.5 1.00  4 32  5 0.5 20 40 1.0 10 158 2400 5.0  5 10  5 5 11 5 210
## 6  1.5 1.5 1.80  9 41  5 1.0 10 20 1.0 24 240  900 5.0  3 10  5 5 23 5 544
##   Akermanite Albite Aluminium.oxide.hydroxide Anhydrite Aragonite Augite
## 1          0      0                         0         0         0      0
## 2          0      0                         0         0         0      0
## 3          0      1                         0         0         0      1
## 4          0      0                         1         0         0      0
## 5          0      0                         0         0         0      0
## 6          0      0                         0         0         0      0
##   Biotite Birnessite Calcite Clinochlore Cuspidine Diaspore Dickite Gehlenite
## 1       0          0       1           0         0        0       0         1
## 2       0          0       1           0         0        0       0         0
## 3       0          0       1           1         0        0       0         0
## 4       0          0       1           0         0        0       0         0
## 5       0          0       1           0         0        1       0         1
## 6       0          0       0           0         0        0       0         0
##   Goethite Haematite Illite Kaolinite Langite Linnaeite Magnesioferrite
## 1        0         0      0         0       0         0               0
## 2        0         0      0         1       0         0               0
## 3        0         0      1         0       0         0               0
## 4        0         0      0         1       0         0               0
## 5        0         0      0         1       0         0               0
## 6        0         0      0         1       0         0               0
##   Melilite Merwinite Microcline Mullite Muscovite Nitratine Orthoclase
## 1        1         0          0       0         0         0          0
## 2        0         0          0       0         1         1          0
## 3        0         0          0       0         1         0          0
## 4        0         0          0       0         1         0          0
## 5        0         0          0       1         0         0          0
## 6        0         0          0       0         1         0          0
##   Orthopyroxene Periclase Pigeonite Phengite Pseudowollastonite Quartz
## 1             0         0         1        0                  0      0
## 2             0         0         1        0                  0      1
## 3             0         0         0        0                  0      1
## 4             0         1         1        0                  0      1
## 5             0         0         0        0                  0      1
## 6             0         0         1        0                  0      1
##   Staurolite Valentinite
## 1          0           0
## 2          0           0
## 3          0           0
## 4          0           0
## 5          0           0
## 6          0           0

#Firstly, here are calculations of means and standard deviations for pH data, including the #original records taken from the pH meter. Means of two matching measurements were used for #final reporting of the data.

Barrow_pH_1 <-c(9.889, 9.953)
Mean_Barrow_pH_1 <-mean(Barrow_pH_1)
print(Mean_Barrow_pH_1)
## [1] 9.921
SD_Mean_Barrow_pH_1 <-sd(c(9.889, 9.953))
print(SD_Mean_Barrow_pH_1)
## [1] 0.04525483
Barrow_pH_2 <-c(8.642, 9.058)
Mean_Barrow_pH_2 <-mean(Barrow_pH_2)
print(Mean_Barrow_pH_2)
## [1] 8.85
SD_Mean_Barrow_pH_2 <-sd(c(8.642, 9.058))
print(SD_Mean_Barrow_pH_2)
## [1] 0.2941564
Barrow_pH_3 <-c(7.752, 7.650)
Mean_Barrow_pH_3 <-mean(Barrow_pH_3)
print(Mean_Barrow_pH_3)
## [1] 7.701
SD_Mean_Barrow_pH_3 <-sd(c(7.752, 7.650))
print(SD_Mean_Barrow_pH_3)
## [1] 0.07212489
Barrow_pH_4 <-c(8.257, 8.332)
Mean_Barrow_pH_4 <-mean(Barrow_pH_4)
print(Mean_Barrow_pH_4)
## [1] 8.2945
SD_Mean_Barrow_pH_4 <-sd(c(8.257, 8.332))
print(SD_Mean_Barrow_pH_4)
## [1] 0.05303301
Barrow_pH_5 <-c(8.376, 8.350)
Mean_Barrow_pH_5 <-mean(Barrow_pH_5)
print(Mean_Barrow_pH_5)
## [1] 8.363
SD_Mean_Barrow_pH_5 <-sd(c(8.376, 8.350))
print(SD_Mean_Barrow_pH_5)
## [1] 0.01838478
Barrow_pH_6 <-c(8.087, 8.007)
Mean_Barrow_pH_6 <-mean(Barrow_pH_6)
print(Mean_Barrow_pH_6)
## [1] 8.047
SD_Mean_Barrow_pH_6 <-sd(c(8.087, 8.007))
print(SD_Mean_Barrow_pH_6)
## [1] 0.05656854
Barrow_pH_7 <-c(9.987, 9.694)
Mean_Barrow_pH_7 <-mean(Barrow_pH_7)
print(Mean_Barrow_pH_7)
## [1] 9.8405
SD_Mean_Barrow_pH_7 <-sd(c(9.987, 9.694))
print(SD_Mean_Barrow_pH_7)
## [1] 0.2071823
Barrow_pH_8 <-c(10.320, 10.268)
Mean_Barrow_pH_8 <-mean(Barrow_pH_8)
print(Mean_Barrow_pH_8)
## [1] 10.294
SD_Mean_Barrow_pH_8 <-sd(c(10.320, 10.268))
print(SD_Mean_Barrow_pH_8)
## [1] 0.03676955
Barrow_pH_9 <-c(10.867, 10.726)
Mean_Barrow_pH_9 <-mean(Barrow_pH_9)
print(Mean_Barrow_pH_9)
## [1] 10.7965
SD_Mean_Barrow_pH_9 <-sd(c(10.867, 10.726))
print(SD_Mean_Barrow_pH_9)
## [1] 0.09970206
Barrow_pH_10 <-c(9.173, 8.864)
Mean_Barrow_pH_10 <-mean(Barrow_pH_10)
print(Mean_Barrow_pH_10)
## [1] 9.0185
SD_Mean_Barrow_pH_10 <-sd(c(9.173, 8.864))
print(SD_Mean_Barrow_pH_10)
## [1] 0.218496
Barrow_pH_11 <-c(10.779, 10.768)
Mean_Barrow_pH_11 <-mean(Barrow_pH_11)
print(Mean_Barrow_pH_11)
## [1] 10.7735
SD_Mean_Barrow_pH_11 <-sd(c(10.779, 10.768))
print(SD_Mean_Barrow_pH_11)
## [1] 0.007778175
Barrow_Uncapped_pH_Mean <- c((9.889 + 9.953 + 8.376 + 8.350 + 10.867 
                             + 10.726 + 10.779 + 10.768)/8)
print(Barrow_Uncapped_pH_Mean)
## [1] 9.9635
Barrow_Capped_pH_Mean <- c((8.642 + 9.058 + 7.752 + 7.650 + 8.257 + 8.332 + 8.087 + 8.007
                               + 9.987 + 9.694 + 10.320 + 10.268 + 9.173 + 8.864)/14)
print(Barrow_Capped_pH_Mean)
## [1] 8.863643
SDuncappedx <- c(9.889, 9.953, 8.376, 8.350, 10.867, 10.726, 10.779, 10.768)
SDuncapped <- sd(SDuncappedx)
print(SDuncapped)
## [1] 1.058245
SDcappedx <- c(8.642, 9.058, 7.752, 7.650, 8.257, 8.332, 8.087, 8.007,
               9.987, 9.694, 10.320, 10.268, 9.173, 8.864)
SDcapped <- sd(SDcappedx)
print(SDcapped)
## [1] 0.916665
pHBoxplot <-boxplot(Capped_and_Uncapped_Barrow_pH$Uncapped , Capped_and_Uncapped_Barrow_pH$Capped)

pHBoxplot
## $stats
##         [,1]   [,2]
## [1,]  8.3630  7.701
## [2,]  9.1420  8.171
## [3,] 10.3475  8.850
## [4,] 10.7855  9.430
## [5,] 10.7970 10.294
## 
## $n
## [1] 4 7
## 
## $conf
##           [,1]     [,2]
## [1,]  9.049135 8.098146
## [2,] 11.645865 9.601854
## 
## $out
## numeric(0)
## 
## $group
## numeric(0)
## 
## $names
## [1] "1" "2"

#Now to look into different concentrations of the most bioavailable elements on the Barrow #slag bank, to better understand results of Renyi analyses, shown in separate file.

min(BarrowGeochemData$Cd)
## [1] 0.25
mean(BarrowGeochemData$Cd)
## [1] 0.6818182
median(BarrowGeochemData$Cd)
## [1] 0.25
max(BarrowGeochemData$Cd)
## [1] 1.8
sd(BarrowGeochemData$Cd)
## [1] 0.5658059
min(BarrowGeochemData$B)
## [1] 10
mean(BarrowGeochemData$B)
## [1] 24.54545
median(BarrowGeochemData$B)
## [1] 20
max(BarrowGeochemData$B)
## [1] 60
sd(BarrowGeochemData$B)
## [1] 16.34848
min(BarrowGeochemData$Zn)
## [1] 24
mean(BarrowGeochemData$Zn)
## [1] 173.0909
median(BarrowGeochemData$Zn)
## [1] 88
max(BarrowGeochemData$Zn)
## [1] 544
sd(BarrowGeochemData$Zn)
## [1] 166.6166
min(BarrowGeochemData$Mo)
## [1] 0.5
mean(BarrowGeochemData$Mo)
## [1] 0.8636364
median(BarrowGeochemData$Mo)
## [1] 1
max(BarrowGeochemData$Mo)
## [1] 1
sd(BarrowGeochemData$Mo)
## [1] 0.2335497
min(BarrowGeochemData$Hg)
## [1] 0.5
mean(BarrowGeochemData$Hg)
## [1] 0.7272727
median(BarrowGeochemData$Hg)
## [1] 0.5
max(BarrowGeochemData$Hg)
## [1] 2
sd(BarrowGeochemData$Hg)
## [1] 0.4670994
min(BarrowGeochemData$Cu)
## [1] 19
mean(BarrowGeochemData$Cu)
## [1] 39.45455
median(BarrowGeochemData$Cu)
## [1] 37
max(BarrowGeochemData$Cu)
## [1] 97
sd(BarrowGeochemData$Cu)
## [1] 20.68508
min(BarrowGeochemData$Pb)
## [1] 11
mean(BarrowGeochemData$Pb)
## [1] 94.09091
median(BarrowGeochemData$Pb)
## [1] 61
max(BarrowGeochemData$Pb)
## [1] 240
sd(BarrowGeochemData$Pb)
## [1] 81.48675
min(BarrowGeochemData$SrO)
## [1] 84.55946
mean(BarrowGeochemData$SrO)
## [1] 207.555
median(BarrowGeochemData$SrO)
## [1] 169.1189
max(BarrowGeochemData$SrO)
## [1] 676.4756
sd(BarrowGeochemData$SrO)
## [1] 174.7893
min(BarrowGeochemData$Ag)
## [1] 0.2
mean(BarrowGeochemData$Ag)
## [1] 0.3818182
median(BarrowGeochemData$Ag)
## [1] 0.3
max(BarrowGeochemData$Ag)
## [1] 0.8
sd(BarrowGeochemData$Ag)
## [1] 0.2088932
min(BarrowGeochemData$As)
## [1] 4
mean(BarrowGeochemData$As)
## [1] 14.27273
median(BarrowGeochemData$As)
## [1] 11
max(BarrowGeochemData$As)
## [1] 60
sd(BarrowGeochemData$As)
## [1] 15.64667
min(BarrowGeochemData$Co)
## [1] 1
mean(BarrowGeochemData$Co)
## [1] 8.090909
median(BarrowGeochemData$Co)
## [1] 7
max(BarrowGeochemData$Co)
## [1] 31
sd(BarrowGeochemData$Co)
## [1] 8.263831

#Looking into biodiversity measurements#

#Will do a series of t-tests and Wilcoxon tests for data. #Means and SDs are obtained through calculation. #Wilcoxon tests are needed for the non-normal data, #which is all apart from Simpson diversity and species evenness, which are fairly #close to ‘perfect’ normal distribution.

UncappedHillq0 <-c(10.045, 19.328, 17.354, 12.883)
Mean_UncappedHillq0 <-mean(UncappedHillq0)
print(Mean_UncappedHillq0)
## [1] 14.9025
SD_Mean_UncappedHillq0 <-sd(c(10.045, 19.328, 17.354, 12.883))
print(SD_Mean_UncappedHillq0)
## [1] 4.21381
CappedHillq0 <-c(13.395, 17.931, 13.495, 9.786, 15.225, 13.332, 10.295)
Mean_CappedHillq0 <-mean(CappedHillq0)
print(Mean_CappedHillq0)
## [1] 13.35129
SD_Mean_CappedHillq0 <-sd(c(13.395, 17.931, 13.495, 9.786, 15.225, 13.332, 10.295))
print(SD_Mean_CappedHillq0)
## [1] 2.785668
hist(Barrow_Diversity$qD)

boxplot(UncappedHillq0, CappedHillq0)

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

#No significant differences.

UncappedHillq1 <-c(4.909, 5.077, 8.451, 8.681)
Mean_UncappedHillq1 <-mean(UncappedHillq1)
print(Mean_UncappedHillq1)
## [1] 6.7795
SD_Mean_UncappedHillq1 <-sd(c(4.909, 5.077, 8.451, 8.681))
print(SD_Mean_UncappedHillq1)
## [1] 2.066147
CappedHillq1 <-c(9.824, 5.827, 6.331, 5.077, 6.415, 6.244, 4.373)
Mean_CappedHillq1 <-mean(CappedHillq1)
print(Mean_CappedHillq1)
## [1] 6.298714
SD_Mean_CappedHillq1 <-sd(c(9.824, 5.827, 6.331, 5.077, 6.415, 6.244, 4.373))
print(SD_Mean_CappedHillq1)
## [1] 1.725721
hist(Barrow_Diversity$Shannon)

boxplot(UncappedHillq1, CappedHillq1)

Shannon_Wilcox <- wilcox.test(Barrow_Diversity[,4] ~ 
                                Barrow_Diversity[,1])

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

#No significant differences.

UncappedHillq2 <-c(3.294, 2.756, 5.476, 6.602)
Mean_UncappedHillq2 <-mean(UncappedHillq2)
print(Mean_UncappedHillq2)
## [1] 4.532
SD_Mean_UncappedHillq2 <-sd(c(3.294, 2.756, 5.476, 6.602))
print(SD_Mean_UncappedHillq2)
## [1] 1.813179
CappedHillq2 <-c(8.348, 4.476, 4.763, 3.688, 4.795, 4.350, 3.436)
Mean_CappedHillq2 <-mean(CappedHillq2)
print(Mean_CappedHillq2)
## [1] 4.836571
SD_Mean_CappedHillq2 <-sd(c(8.348, 4.476, 4.763, 3.688, 4.795, 4.350, 3.436))
print(SD_Mean_CappedHillq2)
## [1] 1.63222
hist(Barrow_Diversity$Simpson)

boxplot(UncappedHillq2, CappedHillq2)

Simpson_ttest <-t.test(Barrow_Diversity[,5] ~ 
                         Barrow_Diversity[,1])

print(Simpson_ttest)
## 
##  Welch Two Sample t-test
## 
## data:  Barrow_Diversity[, 5] by Barrow_Diversity[, 1]
## t = 0.27793, df = 5.8, p-value = 0.7907
## alternative hypothesis: true difference in means between group Capped and group Uncapped is not equal to 0
## 95 percent confidence interval:
##  -2.401201  3.010781
## sample estimates:
##   mean in group Capped mean in group Uncapped 
##               4.836588               4.531798

#No significant differences.

UncappedHillspeciesevenness <-c(0.691, 0.551, 0.770, 0.843)
Mean_UncappedHillspeciesevenness <-mean(UncappedHillspeciesevenness)
print(Mean_UncappedHillspeciesevenness)
## [1] 0.71375
SD_Mean_UncappedHillspeciesevenness <-sd(c(0.691, 0.551, 0.770, 0.843))
print(SD_Mean_UncappedHillspeciesevenness)
## [1] 0.1249997
CappedHillspeciesevenness <-c(0.866, 0.668, 0.742, 0.633, 0.686, 0.694, 0.641)
Mean_CappedHillspeciesevenness <-mean(CappedHillspeciesevenness)
print(Mean_CappedHillspeciesevenness)
## [1] 0.7042857
SD_Mean_CappedHillspeciesevenness <-sd(c(0.866, 0.668, 0.742, 0.633, 0.686, 0.694, 0.641))
print(SD_Mean_CappedHillspeciesevenness)
## [1] 0.08001815
hist(Barrow_Diversity$Species_evenness)

boxplot(UncappedHillspeciesevenness, CappedHillspeciesevenness)

Evenness_ttest <-t.test(Barrow_Diversity[,6] ~
                          Barrow_Diversity[,1])
print(Evenness_ttest)
## 
##  Welch Two Sample t-test
## 
## data:  Barrow_Diversity[, 6] by Barrow_Diversity[, 1]
## t = -0.13705, df = 4.4625, p-value = 0.897
## alternative hypothesis: true difference in means between group Capped and group Uncapped is not equal to 0
## 95 percent confidence interval:
##  -0.1940503  0.1750788
## sample estimates:
##   mean in group Capped mean in group Uncapped 
##              0.7043143              0.7138000

#No significant differences.