Skip to content

Commit

Permalink
Merge pull request #120 from weecology/reports
Browse files Browse the repository at this point in the history
Add nest success summaries and SFWMD report table script [minor]
  • Loading branch information
gmyenni authored Apr 23, 2024
2 parents 91f579b + a197670 commit 9d112f7
Show file tree
Hide file tree
Showing 7 changed files with 671 additions and 31 deletions.
29 changes: 29 additions & 0 deletions DataCleaningScripts/get_nest_success.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,35 @@ unique(success$species[which(!(success$species %in% species$species))])
success <- success %>% dplyr::arrange(year,colony,species)
write.table(success, "Nesting/nest_success.csv", row.names = FALSE, na = "", sep = ",", quote = 18)


success_summary <- read.csv("Nesting/nest_success_summary.csv")
success_summary_new <- read.csv("../Desktop/nest_success_summary.csv") %>%
dplyr::rename_with(tolower) %>%
dplyr::mutate(metric = tolower(metric),
metric = gsub(paste(c("[(]", "[)]"), collapse = "|"), "", metric),
metric = gsub("overall", "", metric),
metric = gsub("success", "", metric),
metric = gsub(" ", "", metric),
colony = replace(colony, colony=="cuthbert", "cuthbert_lake"),
colony = replace(colony, colony=="paurotis", "paurotis_pond")) %>%
tidyr::pivot_longer(cols = !c(year,colony,type,metric),
names_to = "species",
values_to = "value") %>%
dplyr::filter(!is.na(value)) %>%
dplyr::mutate(variable = paste(type,metric,sep="_")) %>%
tidyr::pivot_wider(id_cols = c(year,colony,species), names_from = variable, values_from = value,
values_fill = NA) %>%
dplyr::mutate(year=as.integer(year)) %>%
dplyr::arrange(year,colony,species)

unique(success_summary_new$colony[which(!(success_summary_new$colony %in% colonies$colony))])
unique(success_summary_new$species[which(!(success_summary_new$species %in% species$species))])

success_summary <- success_summary %>%
dplyr::bind_rows(success_summary_new) %>%
dplyr::arrange(year,colony,species)
write.table(success_summary, "Nesting/nest_success_summary.csv", row.names = FALSE, na = "", sep = ",")

# make metadata
success_metadata <- data.frame(name = as.vector(colnames(success))) %>%
dplyr::mutate(class=sapply(success,class),
Expand Down
2 changes: 1 addition & 1 deletion DataCleaningScripts/old_counts.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ counts <- counts %>% dplyr::arrange(counts)
write.csv(counts, "Counts/maxcounts.csv", row.names = FALSE, na = "", quote = 9)

species <- species %>% dplyr::arrange(species)
write.csv(species, "SiteandMethods/species_list.csv", row.names = FALSE, na = "", quote = 5:25)
write.csv(species, "SiteandMethods/species_list.csv", row.names = FALSE, na = "", quote = 7:27)

colonies <- colonies %>% dplyr::arrange(colony)
write.csv(colonies, "SiteandMethods/colonies.csv", row.names = FALSE, na = "", quote = c(7,8))
39 changes: 38 additions & 1 deletion Nesting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,49 @@
Please see the [methods](../SiteandMethods/methods.md) for details about collection and how to use the data.

### Nest Checks

year

colony

nest - nest id

species

date

eggs - number of eggs

chicks - number of chicks

stage - nesting stage
notes

notes

### Nest Success

We use the Mayfield method to calculate nest success. The nest-level metrics required for calculations are stored in this table. See the [metadata](../Nesting/nest_success_metadata.csv) for data details.

### Nest Success Summary

This is colony-level nest success, based on the data from the [nest_success table](../Nesting/nest_success.csv). Success is summarized for the incubation stage, nestling stage, and overall for the whole nesting period.

k - total number of nests

sumy - total number of nests that hatched (s(i))

e - total number of days monitored (n(i))

p - 1-((k-sumy)/e), success

j - incubation or nestling period, in days (constant by species, can be found in the [species table](../SiteandMethods/species.csv))

pj - p\^j, hatch success

varp - (p\*(1-p))/e, variation of p

varpj - varp\*((j\*(p\^(j-1)))\^2), variation of pj

sdp - standard deviation of p

sdpj - standard deviation of pj
Loading

0 comments on commit 9d112f7

Please sign in to comment.