Skip to content

Commit

Permalink
Merge pull request #42 from cct-datascience/plots_4
Browse files Browse the repository at this point in the history
Some final updates
  • Loading branch information
KristinaRiemer authored Sep 12, 2024
2 parents b02a661 + 6f266aa commit 70deb25
Show file tree
Hide file tree
Showing 6 changed files with 173 additions and 104 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,7 @@ Please use the citation below if you use or modify this tool for research purpos
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:SBonar@ag.arizona.edu) or the [CCT Data Science team](mailto:cct-datascience@arizona.edu) with suggestions.You can also create an issue describing a problem with the code or improvements under the "Issues" tab.

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`.

### Acknowledgements

This app was developed in collaboration with the University of Arizona [CCT Data Science](https://datascience.cct.arizona.edu/) team.
14 changes: 6 additions & 8 deletions app/R/functions.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
non_net_methods <- c("boat_electrofishing", "tow_barge_electrofishing",
"raft_electrofishing", "small_mesh_trawl", "large_mesh_trawl")
net_methods <- c("gill_net_spring", "stream_seine", "hoop_net",
"small_catfish_hoopnet", "drifting_trammel_net",
"large_catfish_hoopnet", "seine", "bag_seine")
bp_methods <- c("backpack_electrofishing")
time_methods <- c("boat_electrofishing", "raft_electrofishing")
number_methods <- c("gill_net_fall", "gill_net_spring", "drifting_trammel_net",
"large_catfish_hoopnet", "bag_seine", "stream_seine",
"backpack_electrofishing", "tow_barge_electrofishing")

calculate_cpue <- function(df){
stopifnot(c("type", "area", "common_name", "method", "waterbody_type",
Expand All @@ -12,8 +10,8 @@ calculate_cpue <- function(df){
group_by(type, area, waterbody_name, year, method, waterbody_type, common_name) %>%
summarize(n_fish = n(),
effort_sampleID = mean(effort)) %>%
mutate(effort = case_when(method %in% non_net_methods ~ effort_sampleID / 3600,
method %in% net_methods ~ effort_sampleID)) %>%
mutate(effort = case_when(method %in% time_methods ~ effort_sampleID / 3600,
method %in% number_methods ~ effort_sampleID)) %>%
mutate(cpue = n_fish / effort) %>% # n is number of fish
group_by(type, area, common_name, method, waterbody_type) %>%
summarize_at(vars(cpue), list(mean = mean, se = se,
Expand Down
Loading

0 comments on commit 70deb25

Please sign in to comment.