Skip to content

Commit

Permalink
Add 2024 max count indicator [minor]
Browse files Browse the repository at this point in the history
  • Loading branch information
gmyenni committed Jan 28, 2025
1 parent 89ce7d3 commit c6f7d36
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 16 deletions.
34 changes: 19 additions & 15 deletions DataCleaningScripts/get_indicators.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
library(dplyr)
source("DataCleaningScripts/clean_counts.R")

datayear <- 2024
colonies <- read.csv("SiteandMethods/colonies.csv")
species <- read.csv("SiteandMethods/species_list.csv")
counts <- read.csv("Counts/maxcounts.csv")

data_path <- "~/Dropbox (UFL)/Everglades/Reports/2022 Reports/Final Report Work/Final Report Work_2022/WBPOP_2022_Lindsey takeover.xls"
tab_names <- readxl::excel_sheets(path = data_path)
Expand Down Expand Up @@ -43,17 +40,24 @@ groundcounts <- read.csv("Counts/groundcounts.csv") %>%
write.table(groundcounts, "Counts/groundcounts.csv", row.names = FALSE,
col.names = TRUE, na = "", sep = ",")

# add max count summaries
max_count_raw <- readxl::read_excel(path = data_path, sheet = "WBPOP",
col_names = TRUE, col_types = "text", skip=2) %>%
select(-c(1,16:26),-27,-total) %>%
rename(year=1)

max_count_all <- max_count_raw[16:52,] %>% mutate_if(is.character, as.numeric) %>%
filter(year==datayear) %>%
tidyr::gather(key="species",value="count",-year) %>%
mutate(region="all", species=tolower(species)) %>%
mutate(species = replace(species, species=="unident", "unkn")) %>%
# add max count summary
counts <- read.csv("Counts/maxcounts.csv") %>%
filter(year==datayear) %>%
group_by(year,species) %>%
summarise(count = sum(count))
under40 <- read.csv("Counts/maxcounts_under40.csv") %>%
filter(year==datayear) %>%
select(-c(group_id,colony,colony_old,wca,latitude,longitude,total,notes)) %>%
group_by(year) %>%
summarise(across(where(is.numeric), \(x) sum(x, na.rm = TRUE))) %>%
tidyr::pivot_longer(cols = !year, names_to = "species", values_to = "count")
max_count_all <- bind_rows(counts,under40) %>%
group_by(year,species) %>%
summarise_all(., sum, na.rm = TRUE)
total <- sum(max_count_all$count)
max_count_all <- max_count_all %>% ungroup() %>%
add_row(year=datayear, species = "total", count=total) %>%
mutate(region="all") %>%
select(year,region,species,count)

write.table(max_count_all, "Indicators/max_count_all.csv",
Expand Down
22 changes: 21 additions & 1 deletion Indicators/max_count_all.csv
Original file line number Diff line number Diff line change
Expand Up @@ -530,4 +530,24 @@ year,region,species,count
2023,all,smda,0
2023,all,smwh,1672
2023,all,anhi,568
2023,all,total,34227
2023,all,total,34227
2024,all,anhi,568
2024,all,bcnh,244
2024,all,caeg,0
2024,all,dcco,0
2024,all,gbhe,1436
2024,all,glib,2
2024,all,greg,15670
2024,all,grhe,68
2024,all,lada,0
2024,all,lawh,0
2024,all,lbhe,1468
2024,all,rosp,564
2024,all,smhe,0
2024,all,smwh,3434
2024,all,sneg,5254
2024,all,trhe,24
2024,all,whib,31928
2024,all,wost,764
2024,all,ycnh,0
2024,all,total,61424

0 comments on commit c6f7d36

Please sign in to comment.