ebird / ebird-best-practices

Best Practices for Using eBird Data
https://ebird.github.io/ebird-best-practices/
GNU General Public License v3.0
6 stars 5 forks source link

Error in auk_zerofill #5

Closed ManuelSpinola closed 8 months ago

ManuelSpinola commented 8 months ago

I am following the tutorial ebird Best Practices with my own data I got an error on auk_zerofill

Is not clear for me how can I use the auk_complete() function o solve the problem.

zf <- auk_zerofill(observations, checklists, collapse = TRUE)

Error in auk_zerofill.data.frame(observations, checklists, collapse = TRUE) : Some checklists in sampling event data are not complete. Complete checklists are required for zero-filling. Try calling auk_complete() when filtering.

mstrimas commented 8 months ago

Hi Manuel, sorry you're having trouble with this. This is a common error has been reported on the GitHub repository for the auk package and I outline a solution there: https://github.com/CornellLabofOrnithology/auk/issues/46#issuecomment-697396734

ManuelSpinola commented 8 months ago

Thank you very much.

I followed your advice in the thread that you mentioned, and I solved the problem filtering small batch of my data (by year).

sed_2018 <- "datos_derivados_de_ebird/sed_2018.txt" sed_filter <- auk_sampling("datos_ebird/ebd_CR_smp_relFeb-2024/ebd_CR_smp_relFeb-2024_sampling.txt") %>% auk_country("Costa Rica") %>% auk_date(c("2018-01-01", "2018-12-31")) %>% auk_complete() %>% auk_filter(sed_2018, overwrite=TRUE)

ebd_2018 <- "datos_derivados_de_ebird/ebd_2018.txt" ebd_filter <- auk_ebd("datos_ebird/ebd_CR_smp_relFeb-2024/ebd_CR_smp_relFeb-2024.txt") %>% auk_country("Costa Rica") %>% auk_date(c("2018-01-01", "2018-12-31")) %>% auk_complete() %>% auk_filter(ebd_2018, overwrite=TRUE)

checklists_2018 <- read_sampling("datos_derivados_de_ebird/sed_2018.txt")

observations_2018 <- read_ebd("datos_derivados_de_ebird/ebd_2018.txt")

observations_2018 <- semi_join(observations_2018, checklists_2018, by = "checklist_id")

zf_2018 <- auk_zerofill(observations_2018, checklists_2018, collapse = TRUE)

mstrimas commented 8 months ago

Excellent, glad to hear it worked!