Skip to contents

Exotic codes are applied to eBird observations when the species is believe to be non-native to the given location. This function defines a filter for the eBird Basic Dataset (EBD) to subset observations to one or more of the exotic codes: "" (i.e. no code, meaning it is a native species), "N" (naturalized), "P" (provisional), or "X" (escapee). This function only defines the filter and, once all filters have been defined, auk_filter() should be used to call AWK and perform the filtering.

Usage

auk_exotic(x, exotic_code, replace = FALSE)

Arguments

x

auk_ebd or auk_sampling object; reference to file created by auk_ebd() or auk_sampling().

exotic_code

characterr; exotic codes to filter by. Note that an empty string (""), meaning no exotic code, is used for native species.

replace

logical; multiple calls to auk_exotic() are additive, unless replace = FALSE, in which case the previous list of states to filter by will be removed and replaced by that in the current call.

Value

An auk_ebd object.

Examples

# filter to only native observations
ebd <- auk_ebd(system.file("extdata/ebd-sample.txt", package = "auk"))
auk_exotic(ebd, exotic_code = "")
#> Input 
#>   EBD: /usr/local/lib/R/site-library/auk/extdata/ebd-sample.txt 
#> 
#> Output 
#>   Filters not executed
#> 
#> Filters 
#>   Species: all
#>   Countries: all
#>   States: all
#>   Counties: all
#>   BCRs: all
#>   Bounding box: full extent
#>   Years: all
#>   Date: all
#>   Start time: all
#>   Last edited date: all
#>   Protocol: all
#>   Project code: all
#>   Duration: all
#>   Distance travelled: all
#>   Records with breeding codes only: no
#>   Exotic Codes: Native
#>   Complete checklists only: no

# filter to native and naturalized observations
auk_exotic(ebd, exotic_code = c("", "N"))
#> Input 
#>   EBD: /usr/local/lib/R/site-library/auk/extdata/ebd-sample.txt 
#> 
#> Output 
#>   Filters not executed
#> 
#> Filters 
#>   Species: all
#>   Countries: all
#>   States: all
#>   Counties: all
#>   BCRs: all
#>   Bounding box: full extent
#>   Years: all
#>   Date: all
#>   Start time: all
#>   Last edited date: all
#>   Protocol: all
#>   Project code: all
#>   Duration: all
#>   Distance travelled: all
#>   Records with breeding codes only: no
#>   Exotic Codes: Native, Naturalized
#>   Complete checklists only: no