Read an eBird Basic Dataset file using data.table::fread(), readr::read_delim(), or read.delim() depending on which packages are installed. read_ebd() reads the EBD itself, while read_sampling()` reads a sampling event data file.

read_ebd(x, reader, sep = "\t", unique = TRUE, rollup = TRUE)

# S3 method for character
read_ebd(x, reader, sep = "\t", unique = TRUE,
  rollup = TRUE)

# S3 method for auk_ebd
read_ebd(x, reader, sep = "\t", unique = TRUE,
  rollup = TRUE)

read_sampling(x, reader, sep = "\t", unique = TRUE)

# S3 method for character
read_sampling(x, reader, sep = "\t",
  unique = TRUE)

# S3 method for auk_ebd
read_sampling(x, reader, sep = "\t", unique = TRUE)

# S3 method for auk_sampling
read_sampling(x, reader, sep = "\t",
  unique = TRUE)

Arguments

x

filename or auk_ebd object with associated output files as created by auk_filter().

reader

character; the function to use for reading the input file, options are "fread", "readr", or "base", for data.table::fread(), readr::read_delim(), or read.delim(), respectively. This argument should typically be left empty to have the function choose the best reader based on the installed packages.

sep

character; single character used to separate fields within a row.

unique

logical; should duplicate grouped checklists be removed. If unique = TRUE, auk_unique() is called on the EBD before returning.

rollup

logical; should taxonomic rollup to species level be applied. If rollup = TRUE, auk_rollup() is called on the EBD before returning. Note that this process can be time consuming for large files, try turning rollup off if reading is taking too long.

Value

A data frame of EBD observations. An additional column, checklist_id, is added to output files if unique = TRUE, that uniquely identifies the checklist from which the observation came. This field is equal to sampling_event_identifier for non-group checklists, and group_identifier for group checklists.

Details

This functions performs the following processing steps:

  • Data types for columns are manually set based on column names used in the February 2017 EBD. If variables are added or names are changed in later releases, any new variables will have data types inferred by the import function used.

  • Variables names are converted to snake_case.

  • Duplicate observations resulting from group checklists are removed using auk_unique(), unless unique = FALSE.

Methods (by class)

  • character: Filename of EBD.

  • auk_ebd: auk_ebd object output from auk_filter()

  • character: Filename of sampling event data file

  • auk_ebd: auk_ebd object output from auk_filter(). Must have had a sampling event data file set in the original call to auk_ebd().

  • auk_sampling: auk_sampling object output from auk_filter().

See also

Other import: auk_zerofill

Examples

f <- system.file("extdata/ebd-sample.txt", package = "auk") read_ebd(f)
#> # A tibble: 494 x 45 #> checklist_id global_unique_i… last_edited_date taxonomic_order category #> <chr> <chr> <chr> <dbl> <chr> #> 1 S6852862 URN:CornellLabO… 2016-02-22 14:5… 20145 species #> 2 S14432467 URN:CornellLabO… 2013-06-16 17:3… 20145 species #> 3 S39033556 URN:CornellLabO… 2017-09-06 13:1… 20145 species #> 4 S38303088 URN:CornellLabO… 2017-07-24 15:1… 20145 species #> 5 S14439180 URN:CornellLabO… 2013-06-16 22:2… 20145 species #> 6 S32118689 URN:CornellLabO… 2016-10-19 20:3… 20145 species #> 7 S30663744 URN:CornellLabO… 2016-11-16 13:5… 20145 species #> 8 S39245968 URN:CornellLabO… 2017-09-18 05:2… 20145 species #> 9 S9816729 URN:CornellLabO… 2012-02-12 17:2… 20145 species #> 10 S30669718 URN:CornellLabO… 2016-07-13 13:0… 20145 species #> # … with 484 more rows, and 40 more variables: common_name <chr>, #> # scientific_name <chr>, observation_count <chr>, #> # breeding_bird_atlas_code <chr>, breeding_bird_atlas_category <chr>, #> # age_sex <chr>, country <chr>, country_code <chr>, state <chr>, #> # state_code <chr>, county <chr>, county_code <chr>, iba_code <chr>, #> # bcr_code <int>, usfws_code <chr>, atlas_block <chr>, locality <chr>, #> # locality_id <chr>, locality_type <chr>, latitude <dbl>, longitude <dbl>, #> # observation_date <date>, time_observations_started <chr>, #> # observer_id <chr>, sampling_event_identifier <chr>, protocol_type <chr>, #> # protocol_code <chr>, project_code <chr>, duration_minutes <int>, #> # effort_distance_km <dbl>, effort_area_ha <dbl>, number_observers <int>, #> # all_species_reported <lgl>, group_identifier <chr>, has_media <lgl>, #> # approved <lgl>, reviewed <lgl>, reason <chr>, trip_comments <chr>, #> # species_comments <chr>
# read a sampling event data file x <- system.file("extdata/zerofill-ex_sampling.txt", package = "auk") %>% read_sampling()