Skip to content

Commit 70deb25

Browse files
Merge pull request #42 from cct-datascience/plots_4
Some final updates
2 parents b02a661 + 6f266aa commit 70deb25

File tree

6 files changed

+173
-104
lines changed

6 files changed

+173
-104
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,7 @@ Please use the citation below if you use or modify this tool for research purpos
4949
If you would like to suggest or make changes to this app, there are a few ways to do so. You can reach out via email to [Scott Bonar](mailto:[email protected]) or the [CCT Data Science team](mailto:[email protected]) with suggestions.You can also create an issue describing a problem with the code or improvements under the "Issues" tab.
5050

5151
If you can make changes to the code yourself, feel free to fork this repo and make a pull request. To run the code locally, follow the instructions in `run_locally.md`. It will be necessary to download the ecoregions map data by running `app/download_map_data.R`. Additionally, running the app locally requires the standardized fish records location data file `app/sites.csv`, which is not available in the repo due to sensitive information. Package versions and dependencies are tracked with `renv`.
52+
53+
### Acknowledgements
54+
55+
This app was developed in collaboration with the University of Arizona [CCT Data Science](https://datascience.cct.arizona.edu/) team.

app/R/functions.R

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
non_net_methods <- c("boat_electrofishing", "tow_barge_electrofishing",
2-
"raft_electrofishing", "small_mesh_trawl", "large_mesh_trawl")
3-
net_methods <- c("gill_net_spring", "stream_seine", "hoop_net",
4-
"small_catfish_hoopnet", "drifting_trammel_net",
5-
"large_catfish_hoopnet", "seine", "bag_seine")
6-
bp_methods <- c("backpack_electrofishing")
1+
time_methods <- c("boat_electrofishing", "raft_electrofishing")
2+
number_methods <- c("gill_net_fall", "gill_net_spring", "drifting_trammel_net",
3+
"large_catfish_hoopnet", "bag_seine", "stream_seine",
4+
"backpack_electrofishing", "tow_barge_electrofishing")
75

86
calculate_cpue <- function(df){
97
stopifnot(c("type", "area", "common_name", "method", "waterbody_type",
@@ -12,8 +10,8 @@ calculate_cpue <- function(df){
1210
group_by(type, area, waterbody_name, year, method, waterbody_type, common_name) %>%
1311
summarize(n_fish = n(),
1412
effort_sampleID = mean(effort)) %>%
15-
mutate(effort = case_when(method %in% non_net_methods ~ effort_sampleID / 3600,
16-
method %in% net_methods ~ effort_sampleID)) %>%
13+
mutate(effort = case_when(method %in% time_methods ~ effort_sampleID / 3600,
14+
method %in% number_methods ~ effort_sampleID)) %>%
1715
mutate(cpue = n_fish / effort) %>% # n is number of fish
1816
group_by(type, area, common_name, method, waterbody_type) %>%
1917
summarize_at(vars(cpue), list(mean = mean, se = se,

0 commit comments

Comments
 (0)