-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jeeban.Rmd
120 lines (90 loc) · 5.44 KB
/
Jeeban.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
---
title: "Well water salinity in Charlestown, Rhode Island"
author: "Jeeban Panthi, Thomas Boving, Soni M Pradhanang"
date: "`r Sys.Date()`"
output:
html_document: default
pdf_document: default
---
# Introduction
Provate well water quality data for the Charlestown area were collected by the town office (http://www.charlestownri.org/) since 2008. There are many water quality parameters, but for this project I'm analyzing the indicators of salinity (EC and TDS). For the confidential purpose, the GIS points have been modified from the original datasets.
## Global Options
```{r global_options, include=TRUE}
knitr::opts_chunk$set(echo = TRUE, warning=FALSE, message=FALSE,
fig.width=12, fig.height=8, fig.path='figs/')
```
## Required R packages
```{r loadlib, echo=TRUE}
library(tidyverse)
library(ggplot2)
library(lubridate)
library(gridExtra)
library(dplyr)
library(ggpubr)
library(Hmisc)
library(readxl)
library(rgdal)
library(gstat)
library(sp)
library(raster)
library(mapview)
library(sf)
```
## Reading Data
```{r loaddata, echo=TRUE}
water <- read_excel("~/Desktop/bio/project/water.xlsx", na = " ") %>%
mutate_at(vars(Nitrite:VOC), as.numeric)
```
###Study site
```{r, research site in google map}
charlestown_bnd <- st_read("~/Desktop/bio/project/Municipalities_1997/Municipalities_1997.shp") %>%
filter(NAME == "CHARLESTOWN") %>%
st_transform(crs = "+proj=utm +zone=19 +ellps=WGS84 +datum=WGS84 +no_defs") %>%
as("Spatial")
water_sp <- SpatialPoints(water[,c("Long","Lat")], proj4string = CRS("+proj=longlat +datum=WGS84"))
water_sp <- SpatialPointsDataFrame(water_sp, water)
water_sp <- spTransform(water_sp, CRS(proj4string(charlestown_bnd)))
mapview(water_sp) + charlestown_bnd
```
Charlestown, as shown in above map is a municipality in southern part of Rhode Island. Blue circles on the map indicate the well water sampling locations. You can click on the layer icon on the top left of the map to add different base maps.
#Plots
###1. Number of water samples collected every year
```{r number_of_water_samples_by_year}
ggplot(water) + stat_count(aes(x = Year, fill =Rt1_ref ), position = "dodge")+ylab('Number of samples')+xlab('Year')+theme(axis.text.x = element_text(angle = 90))+scale_x_continuous(breaks=seq(2008, 2017, 1))
```
Figure 1: Number of water samples collected every year from the study area
The starting year is 2008 and the data goes until 2017. In recent years, the number of samples is increasing in general.
###2. Total dissolved solids value in below and above the route 1 road
```{r EC_Rt1_ref}
ggplot(water, aes(x=Rt1_ref, y=TDS))+ geom_boxplot(alpha = 1,color='blue')+xlab('From Route - 1')+ylab('Total dissolved solids (mg/L)')+ stat_summary(fun.y=mean, color="red", geom="point", shape=15, size=1,show_guide = T, show.legend = T) + theme_bw()
```
Figure 2: TDS level below and above Route-1 highway
The electrical conductivity level (a proxy of salt water) is higher below the Route-1 highway than above.It signals potential issue of saltwater intrusion.
###3. Monthly avarage value of TDS
```{r Monthly_average_TDS}
water$Month<-as.character(as.numeric(water$Month))
ggplot(water, aes(x=Month, y=TDS))+ geom_boxplot(alpha = 1,color='blue')+xlab('Months')+ylab('Total dissolved solids (mg/L)')+ stat_summary(fun.y=mean, color="red", geom="point", shape=15, size=1,show_guide = T, show.legend = T) + theme_bw()
```
Figure 3: Seasonal variation in TDS value
###4. Yearly avarage value of TDS
```{r Yearly_average_TDS}
water$Year<-as.character(as.numeric(water$Year))
water_2010<-water[ which(water$Year>2010),]
ggplot(water_2010, aes(x=Year, y=TDS))+ geom_boxplot(alpha = 1,color='black')+xlab('Year')+ylab('Total dissolved solids (mg/L)')+ stat_summary(fun.y=mean, color="red", geom="point", shape=15, size=1,show_guide = T, show.legend = T) + theme_bw()+geom_smooth(method="lm", se=FALSE, color="blue", aes(group=1))
```
Figure 4: Yearly variation of total dissolved solids.
It shows that the annual TDS values does not show any significant trend.
###5. Relationship between TDS and Chloride
```{r correlation_EC_Chloride}
ggscatter(water, x = "TDS", y = "Chloride", color = "black", shape = 21, size = 2, add = "reg.line", conf.int = TRUE, cor.coef = TRUE, cor.method = "pearson", ylab = "Chloride (mg/L)", xlab = "TDS (mg/L)")
c4 <- cor.test(water$EC,water$Chloride)
```
Figure 5: Correlation graph of Electrical conductivity and chloride content in well water.
The p-value of the test is less than the significance level alpha = 0.05. We can conclude that EC and chloride content are significantly positively correlated with a correlation coefficient of `r c4$estimate` and p-value of `r c4$p.value` (rounding off).There is 95% confidence that the true regression line lies within the shaded region. It shows us the uncertainty inherent in our estimate of the true relationship of EC and Chloride.It indicates that chlorine compliments to the EC and vice versa.
###6. Relationship between TDS and Coliform present
```{r relationship between TDS and Coliform}
ggplot(water, aes(x=Coliform, y=TDS))+
geom_boxplot(alpha = 1,color='blue')+xlab('Coliform presense/absence')+ylab('Total Dissolved Solids (mg/L)')+ stat_summary(fun.y=mean, color="red", geom="point", shape=15, size=1,show_guide = T, show.legend = T) + theme_bw()
```
Figure 6: TDS value and Coliform present relationship.
The TDS value is high where the coliform is present. It signals that the wells were contaminated anthropogenically therefore coliform and higher salinity was found.