CornellLabofOrnithology / auk

Working with eBird data in R
https://CornellLabofOrnithology.github.io/auk/
GNU General Public License v3.0
137 stars 22 forks source link

auk_breeding doesn't work since columns updated #58

Closed julieannhart closed 3 years ago

julieannhart commented 3 years ago

The breeding and behavior code columns were changed in spring 2021 and the auk_breeding script still refers to the old column names. Here is the error I get when using the auk_breeding function to filter data:

 ebd_filters <- auk::auk_ebd(fname_ebirdny) %>%
     auk::auk_project("EBIRD_ATL_NY") %>%
     auk::auk_breeding() %>%
     auk::auk_state("US-NY")

Error in auk_breeding.auk_ebd(.) : Breeding code column missing from EBD

I am using the latest CRAN version 0.5.0 of auk and EBD data downloaded 10/17/2021.

julieannhart commented 3 years ago

Some more info: the auk_ebd function is looking for column name "Breeding Bird Atlas Code" which has been replaced by "Breeding Code" and "Behavior Code". I'm not sure how the information is stored, so it may be a simple replacement or a combination of the two columns.

https://github.com/CornellLabofOrnithology/auk/blob/015f8448df0fe9e12b64a4e5de045de23ce8bab6/R/auk-ebd.r#L104

The first row of the EBD I have has these columns:

GLOBAL UNIQUE IDENTIFIER LAST EDITED DATE TAXONOMIC ORDER CATEGORY COMMON NAME SCIENTIFIC NAME SUBSPECIES COMMON NAME SUBSPECIES SCIENTIFIC NAME OBSERVATION COUNT BREEDING CODE BREEDING CATEGORY BEHAVIOR CODE AGE/SEX COUNTRY COUNTRY CODE STATE STATE CODE COUNTY COUNTY CODE IBA CODE BCR CODE USFWS CODE ATLAS BLOCK LOCALITY LOCALITY ID LOCALITY TYPE LATITUDE LONGITUDE OBSERVATION DATE TIME OBSERVATIONS STARTED OBSERVER ID SAMPLING EVENT IDENTIFIER PROTOCOL TYPE PROTOCOL CODE PROJECT CODE DURATION MINUTES EFFORT DISTANCE KM EFFORT AREA HA NUMBER OBSERVERS ALL SPECIES REPORTED GROUP IDENTIFIER HAS MEDIA APPROVED REVIEWED REASON TRIP COMMENTS SPECIES COMMENTS

mstrimas commented 3 years ago

Thanks for catching that Julie! Should be fixed now, but let me know if you're still having problems.