-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsite_plots_BlueSpot.Rmd
More file actions
49 lines (39 loc) · 1.11 KB
/
site_plots_BlueSpot.Rmd
File metadata and controls
49 lines (39 loc) · 1.11 KB
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
---
title: "main"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, message = FALSE, warning = FALSE)
```
```{r}
library("tidyverse")
source("data_cleaning.R")
```
```{r}
clean_ccstandards <- central_coast_standards %>%
mutate(limit = gsub("(<|>|,) ?","",WaterQualityStandard)) %>%
separate(limit,c("limit","units"),sep = " ") %>%
mutate(limit = as.numeric(limit))
```
```{r}
unique(chemistry$ParameterCode)
chemistry <- chemistry %>%
mutate(limit =
case_when(
ParameterCode == "conductivity" ~ "3000",
ParameterCode == "do" ~ "5",
ParameterCode == "do % sat" ~ "100",
ParameterCode == "ph" ~ "8.5",
ParameterCode == "temp" ~ "25",
ParameterCode == "turb" ~ "25")) %>%
mutate(limit = as.numeric(limit))
chem <- split(chemistry, chemistry$ParameterCode)
plot_fun <- function(param){
ggplot(param, aes(x = SampleDate, y = Result)) +
geom_line() +
facet_wrap(~ StationID, scales = "free") +
geom_hline(yintercept = param$limit, color = "red") +
theme_bw()
}
map(chem, plot_fun)
```