-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPI_data.R
68 lines (50 loc) · 1.73 KB
/
PI_data.R
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
# read in PI data to be able to plot on temperature line graph
PI <- readxl::read_xlsx(here::here('data', '2022-08-29_PI-data-mo-OR_clip.xlsx'))
# renaming for joining to GTM data
PI<-rename(PI, date_sampled = datetimestamp)
PI<-rename(PI, site_friendly = station_code)
#organizing PI data
PI2 <- PI %>%
select(date_sampled, wtem_n, site_friendly) %>%
pivot_longer(cols = 2,
names_to = "component_short",
values_to = "result")
#organizing GTM data to match with PI data
dat2temp <- dat2 %>%
select(date_sampled,
component_short,
result,
site_friendly)
datpi <- PI2 %>%
full_join(dat2temp, by = c("date_sampled","component_short", "result", "site_friendly"))
datpi %>%
ggplot(aes(x = date_sampled, y = result, color = site_friendly)) +
geom_line(size = 1) +
geom_point(size = 2) +
scale_colour_manual(name = "Site", values = sitecolours) +
cowplot::theme_cowplot() +
scale_y_continuous(expand = c(0,0)) +
labs(y = "",
x = "")
# getting TN values to graph
PI2 <- PI %>%
select(date_sampled, tn, site_friendly) %>%
ggplot(aes(x = date_sampled, y = tn)) +
geom_line(size = 1) +
cowplot::theme_cowplot() +
scale_y_continuous(expand = c(0,0)) +
labs(y = "",
x="")
ggsave(plot = x, filename = here("output", "PItemp.png"), dpi = 120)
temp <- dat2 %>%
left_join(PI2, by = c("station_code","date_sampled", "component_short", "result"))
temp %>%
ggplot(aes(x = date_sampled, y = result)) +
geom_point(size = 3) +
geom_line(size = 1) +
scale_colour_manual(name = "Site", values = sitecolours) +
cowplot::theme_cowplot() +
scale_y_continuous() +
labs(y = Water Temperature C,
x = "")
PItemp <- dplyr::select (wtem_n, datetimestamp)