Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nest success summaries and SFWMD report table script [minor] #120

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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