-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathzoops.R
77 lines (62 loc) · 2.44 KB
/
zoops.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
69
70
71
72
73
74
75
76
77
#
library(tidyverse)
yrtyp = read_csv("Data/wateryeartypes.csv")
zoops = read_csv(file = "Zoop_month_ave2.csv")
regs = read_csv("Rosies_regions.csv")
zoop = left_join(zoops, regs) %>%
filter(month %in% c(8,9,10,11)) %>%
rename(Year = water_year)
zoop2 = group_by(zoop, Region, Year) %>%
summarize(BPUE = mean(month_BPUE)) %>%
left_join(yrtyp)
ggplot(filter(zoop2, Year >2011, Year < 2020, !is.na(Region)),
aes(x = Region, y = BPUE, fill = YT))+
geom_col() + facet_wrap(~Year)
zoop3 = group_by(zoop2, Region) %>%
summarize(mBPUE = mean(BPUE, na.rm =T),
sd = sd(BPUE, na.rm = T),
se = sd/n())
ggplot(zoop3, aes(x = Region, y = mBPUE)) + geom_col()
zoop3rec = zoop2 %>%
filter(Year >2000, Year <2020, !is.na(Region)) %>%
group_by(Region) %>%
summarize(mBPUE = mean(BPUE, na.rm =T),
sd = sd(BPUE, na.rm = T),
se = sd/n())
ggplot(zoop3rec, aes(x = Region, y = mBPUE, fill = Region)) +
geom_col()+
geom_errorbar(aes(ymin = mBPUE-sd, ymax = mBPUE + sd))
#look at the North Delta by season
zoopx = left_join(zoops, regs) %>%
filter(!is.na(Region), Region == "North") %>%
mutate(Season = case_when(
month %in% c(12,1,2) ~ "Winter",
month %in% c(3,4,5) ~ "Spring",
month %in% c(6,7,8) ~ "Summer",
month %in% c(9,10,11) ~"Fall"
), Season = factor(Season, levels = c("Spring", "Summer", "Fall", "Winter"))) %>%
rename(Year = water_year)
zoop2x = group_by(zoopx, Region, Year, Season) %>%
summarize(BPUE = mean(month_BPUE)) %>%
left_join(yrtyp) %>%
mutate(Season = factor(Season, levels = c("Spring", "Summer", "Fall", "Winter"))) %>%
filter(Year > 2010, Year < 2020)
ggplot(zoop2x, aes(x = Season, y = BPUE, fill = YT)) + geom_col()+
facet_wrap(~Year)
#look at the Suisun by season
zoopS = left_join(zoops, regs) %>%
filter(!is.na(Region), Region == "Suisun Marsh") %>%
mutate(Season = case_when(
month %in% c(12,1,2) ~ "Winter",
month %in% c(3,4,5) ~ "Spring",
month %in% c(6,7,8) ~ "Summer",
month %in% c(9,10,11) ~"Fall"
), Season = factor(Season, levels = c("Spring", "Summer", "Fall", "Winter"))) %>%
rename(Year = water_year)
zoop2S = group_by(zoopS, Region, Year, Season) %>%
summarize(BPUE = mean(month_BPUE)) %>%
left_join(yrtyp) %>%
mutate(Season = factor(Season, levels = c("Spring", "Summer", "Fall", "Winter"))) %>%
filter(Year > 2010, Year < 2020)
ggplot(zoop2S, aes(x = Season, y = BPUE, fill = YT)) + geom_col()+
facet_wrap(~Year)