-
Notifications
You must be signed in to change notification settings - Fork 0
/
summarizing_results.R
60 lines (49 loc) · 1.48 KB
/
summarizing_results.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
# Get values we list in the results section of the paper
library(targets)
library(tidyverse)
# Number of sites used in model
tar_read(p3_static_attributes) %>%
pull(site_no) %>%
unique() %>%
length()
# Number of site-days of SpC data
tar_read(p3_ts_sc_qualified) %>%
nrow()
# Median number of SpC records per site
tar_read(p3_ts_sc_qualified) %>%
group_by(site_no) %>%
tally() %>%
pull(n) %>%
median()
# Number of sites with records >= 10 years
tar_read(p3_ts_sc_qualified) %>%
group_by(site_no) %>%
tally() %>%
filter(n > 365*10) %>%
pull(site_no) %>%
unique() %>%
length()
# Number of sites per stream order
tar_read(p3_static_attributes) %>%
group_by(attr_streamorder) %>%
tally()
# Median specific conductance
medianSpC_tbl <- tar_read(p3_ts_sc_qualified) %>%
group_by(site_no) %>%
summarize(medianSpC = median(SpecCond)) %>%
left_join(select(tar_read(p3_static_attributes),
site_no, attr_streamorder),
by = 'site_no')
range(medianSpC_tbl$medianSpC)
median(medianSpC_tbl$medianSpC)
# Correlation of SpC and streamorder
plot(medianSpC_tbl$medianSpC, medianSpC_tbl$attr_streamorder)
cor.test(medianSpC_tbl$medianSpC, medianSpC_tbl$attr_streamorder)
# Number of episodic sites
episodic_sites <- tar_read(p4_episodic_sites)
length(episodic_sites)
# Number of episodic sites per stream order
tar_read(p3_static_attributes) %>%
filter(site_no %in% episodic_sites) %>%
group_by(attr_streamorder) %>%
tally()