We will begin by loading in the packages we will use in our analysis
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse) # the most popular R package (contains multiple packages)
library(here) # allows us to: cut out long file paths, never set working directories, and make our code reproducible
library(janitor) # cleans the column names in our dataframe
library(lubridate) # helps us to work with dates
library(plotly) # makes static plots interactive
kalauhaihai_oxygen_SeptJan2024 <- read_csv(here("data/data_oxygen_SeptJan2024_Kalauhaihai_21515403.csv"), skip = 1)
kanewai_oxygen_SeptJan2024 <- read_csv(here("data/data_oxygen_SeptJan2024_Kanewai_21446085.csv"), skip = 1)
Oxygen team - now try reading in the following files
kalauhaihai_oxygen_SeptJan2024 <- kalauhaihai_oxygen_SeptJan2024 %>%
clean_names()
kanewai_oxygen_SeptJan2024 <- kanewai_oxygen_SeptJan2024 %>%
clean_names()
Oxygen team - now try cleaning column names for the FebMar2024 files
colnames(kalauhaihai_oxygen_SeptJan2024)[colnames(kalauhaihai_oxygen_SeptJan2024) == "date_time_gmt_10_00"] = "date_time"
colnames(kalauhaihai_oxygen_SeptJan2024)[colnames(kalauhaihai_oxygen_SeptJan2024) == "do_conc_mg_l_lgr_s_n_21515403_sen_s_n_21515403"] = "dissolved_oxygen_mg_l"
colnames(kalauhaihai_oxygen_SeptJan2024)[colnames(kalauhaihai_oxygen_SeptJan2024) == "temp_c_lgr_s_n_21515403_sen_s_n_21515403"] = "temp_celcius"
kalauhaihai_oxygen_SeptJan2024 <- kalauhaihai_oxygen_SeptJan2024 %>%
select(date_time, dissolved_oxygen_mg_l, temp_celcius)
colnames(kanewai_oxygen_SeptJan2024)[colnames(kanewai_oxygen_SeptJan2024) == "date_time_gmt_10_00"] = "date_time"
colnames(kanewai_oxygen_SeptJan2024)[colnames(kanewai_oxygen_SeptJan2024) == "do_conc_mg_l_lgr_s_n_21446085_sen_s_n_21446085"] = "dissolved_oxygen_mg_l"
colnames(kanewai_oxygen_SeptJan2024)[colnames(kanewai_oxygen_SeptJan2024) == "temp_c_lgr_s_n_21446085_sen_s_n_21446085"] = "temp_celcius"
kanewai_oxygen_SeptJan2024 <- kanewai_oxygen_SeptJan2024 %>%
select(date_time, dissolved_oxygen_mg_l, temp_celcius)
Oxygen team - now try changing the column names and selecting the relevant columns for the FebMar2024 files
kalauhaihai_oxygen_SeptJan2024$date_time <- mdy_hms(kalauhaihai_oxygen_SeptJan2024$date_time)
kanewai_oxygen_SeptJan2024$date_time <- mdy_hms(kanewai_oxygen_SeptJan2024$date_time)
Oxygen team - now try changing the class of the date time column for the FebMar2024 files
ggplot(kalauhaihai_oxygen_SeptJan2024, aes(x = date_time,
y = dissolved_oxygen_mg_l)) +
geom_line()
ggplot(kanewai_oxygen_SeptJan2024, aes(x = date_time,
y = dissolved_oxygen_mg_l)) +
geom_line()
Kalauhaihai Oxygen
start time = 9/18/2023 13:45:00
end time = 1/17/2024 9:42:00
kalauhaihai_oxygen_SeptJan2024_start <- as.POSIXct("09-18-2023 13:45:00", format = "%m-%d-%Y %H:%M:%S")
kalauhaihai_oxygen_SeptJan2024_stop <- as.POSIXct("01-17-2024 9:42:00", format = "%m-%d-%Y %H:%M:%S")
kalauhaihai_oxygen_SeptJan2024_trimmed <- kalauhaihai_oxygen_SeptJan2024 %>%
filter(date_time >= kalauhaihai_oxygen_SeptJan2024_start & date_time <= kalauhaihai_oxygen_SeptJan2024_stop)
Kanewai Oxygen
kanewai_oxygen_SeptJan2024_start <- as.POSIXct("09-18-2023 14:45:00", format = "%m-%d-%Y %H:%M:%S")
kanewai_oxygen_SeptJan2024_stop <- as.POSIXct("01-17-2024 10:19:00", format = "%m-%d-%Y %H:%M:%S")
kanewai_oxygen_SeptJan2024_trimmed <- kanewai_oxygen_SeptJan2024 %>%
filter(date_time >= kanewai_oxygen_SeptJan2024_start & date_time <= kanewai_oxygen_SeptJan2024_stop)
Oxygen team - now try trimming the FebMar2024 files
ggplot(kalauhaihai_oxygen_SeptJan2024_trimmed, aes(x = date_time,
y = dissolved_oxygen_mg_l)) +
geom_line()
ggplot(kanewai_oxygen_SeptJan2024_trimmed, aes(x = date_time,
y = dissolved_oxygen_mg_l)) +
geom_line()
Oxygen team - now try plotting the FebMar2024 files
kalauhaihai_oxygen_SeptJan2024_plot <- ggplot(kalauhaihai_oxygen_SeptJan2024_trimmed, aes(x = date_time,
y = dissolved_oxygen_mg_l)) +
geom_line(color = "steelblue") +
theme_minimal() +
labs(title = "Kalauhaihai Oxygen Data",
subtitle = "September 2023 - January 2024",
x = "Date & Time",
y = "Dissolved Oxygen (mg/L)")
kalauhaihai_oxygen_SeptJan2024_plot
ggplotly(kalauhaihai_oxygen_SeptJan2024_plot)
kanewai_oxygen_SeptJan2024_plot <- ggplot(kanewai_oxygen_SeptJan2024_trimmed, aes(x = date_time,
y = dissolved_oxygen_mg_l)) +
geom_line(color = "steelblue") +
theme_minimal() +
labs(title = "Kanewai Oxygen Data",
subtitle = "September 2023 - January 2024",
x = "Date & Time",
y = "Dissolved Oxygen (mg/L)")
kanewai_oxygen_SeptJan2024_plot
ggplotly(kanewai_oxygen_SeptJan2024_plot)
Oxygen team - now try customizing the plots for the FebMar2024 files
kalauhaihai_conductivity_FebApr2024 <- read_csv(here("data/data_conductivity_FebApr2024_KalauhaihaiGarage_21415543.csv"), skip = 1)
Conductivity team - now try reading in the following file
Then:
kalauhaihai_pH_FebApr2024 <- read_csv(here("data/data_pH_FebApr2024_KalauhaihaiGarage_21873460.csv"))
pH team - now try reading in the following file
Then:
kalauhaihai_garage_temp_FebApr2024 <- read_csv(here("data/data_temp_FebApr2024_KalauhaihaiGarage_21445019.csv"), skip = 1)
kalauhaihai_makaha_temp_FebApr2024 <- read_csv(here("data/data_temp_FebApr2024_KalauhaihaiMakaha_20970122.csv"), skip = 1)
kanewai_auwai_temp_FebApr2024 <- read_csv(here("data/data_temp_FebApr2024_KanewaiAuwaiUnderFootBridge_20970102.csv"), skip = 1)
kanewai_fishpond_edge_temp_FebApr2024 <- read_csv(here("data/data_temp_FebApr2024_KanewaiFishpondEdgeNorfolk_20970107.csv"), skip = 1)
kanewai_rock_stairs_temp_FebApr2024 <- read_csv(here("data/data_temp_FebApr2024_KanewaiRockStairsByWall_20970108.csv"), skip = 1)
kanewai_spring_ledge_temp_FebApr2024 <- read_csv(here("data/data_temp_FebApr2024_KanewaiSpringLedgeMakaiEnd_21445022.csv"), skip = 1)
Oxygen Team
Conductivity Team
pH Team
Steps