Scientific Reasoning 3

First load in the libraries

#Load the libraries

library(tidyverse)
── 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(zoo)

Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric
library(plotly)

Attaching package: 'plotly'

The following object is masked from 'package:ggplot2':

    last_plot

The following object is masked from 'package:stats':

    filter

The following object is masked from 'package:graphics':

    layout
#set the working directory
setwd("C:/Users/andy/Desktop/rDataSets")
saltWatch <- read_csv("Salt Watch Muddy Branch 2022R.csv")
Rows: 31 Columns: 6
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (3): Data Source, Date, Description
dbl (3): Chloride Reading, Latitude, Longitude

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

Clean up data

#lower case and get rid of space
names(saltWatch) <- tolower(names(saltWatch))
names(saltWatch) <- gsub(" ","_",names(saltWatch))
head(saltWatch)
# A tibble: 6 × 6
  data_source     date      chloride_reading description      latitude longitude
  <chr>           <chr>                <dbl> <chr>               <dbl>     <dbl>
1 Clean Water Hub 1/28/2022               91 Pulled from the…     39.1     -77.2
2 Clean Water Hub 1/28/2022              167 Pulled from the…     39.1     -77.2
3 Clean Water Hub 1/29/2022              332 Pulled from the…     39.1     -77.2
4 Clean Water Hub 1/30/2022              280 Pulled from the…     39.1     -77.2
5 Clean Water Hub 1/30/2022              497 Pulled from the…     39.1     -77.2
6 Clean Water Hub 2/4/2022               215 Pulled from the…     39.1     -77.2
#get rid of the year in the date format
saltWatch$date <- as.Date(saltWatch$date, format="%m/%d/%Y")
saltWatch$date
 [1] "2022-01-28" "2022-01-28" "2022-01-29" "2022-01-30" "2022-01-30"
 [6] "2022-02-04" "2022-02-12" "2022-02-19" "2022-02-27" "2022-02-27"
[11] "2022-02-27" "2022-03-05" "2022-03-13" "2022-03-18" "2022-04-15"
[16] "2022-05-02" "2022-05-14" "2022-07-10" "2022-07-23" "2022-08-07"
[21] "2022-08-21" "2022-09-04" "2022-09-17" "2022-10-16" "2022-10-21"
[26] "2022-10-29" "2022-10-30" "2022-11-13" "2022-11-28" "2022-12-11"
[31] "2022-12-25"
saltWatch$month_day2022 <- format(saltWatch$date, "%m-%d")
saltWatch$month_day2022
 [1] "01-28" "01-28" "01-29" "01-30" "01-30" "02-04" "02-12" "02-19" "02-27"
[10] "02-27" "02-27" "03-05" "03-13" "03-18" "04-15" "05-02" "05-14" "07-10"
[19] "07-23" "08-07" "08-21" "09-04" "09-17" "10-16" "10-21" "10-29" "10-30"
[28] "11-13" "11-28" "12-11" "12-25"

Make a interactive scatterplot

We want to see the levels of chloride in bodies of water throughout the year.

scatterplot1 <- ggplot(data = saltWatch, 
                   aes(x = month_day2022,
                       y = chloride_reading)) +
  geom_point(color="brown", size=3)+ 
  labs(title = "Montgomery County Chloride Levels in Waterbodies 2022",
       x = "Date in 2022",
       y = "Chloride Levels (Milligrams per liter)")+
       theme_bw()+ 
       theme(axis.text.x = element_text(angle=75))


ggplotly(scatterplot1)

Analysis:

The data shows the different levels of chloride in Montgomery County, Maryland’s water bodies in 2022. The data set includes the source and descriptions of where the samples were taken from. On the graph, the x-axis tracks which time of the year the samples were taken. The y-axis displays the chloride levels in milligrams per liter throughout 2022. Trends that I see are higher levels of chloride in the water bodies in the months of January through March than April through December. Chloride from road salt in water is toxic and harmful to the environment.

The hypothesis is that if the levels of chloride in the water are higher in the winter months of January through March then the water quality will be worse compared to bodies of water that have less chloride.

First, the control group would be a body of water that was not affected by chloride. The experimental group would be multiple bodies of water that were affected by chloride. Both bodies of water will have samples taken from them and receive chloride readings. The experiment can be repeated by taking multiple samples of different bodies of water around Montgomery County and measuring the levels of chloride.

The chloride readings would serve as data to determine whether a body of water is toxic. Additional data collected could be observations of plant and animal life in the bodies of water to determine the water quality.