
Introduction to the rebird package
Sebastian Pardo, Rafael Maia
2026-11-29
Source:vignettes/rebird_vignette.Rmd
rebird_vignette.RmdA programmatic interface to the eBird database. Find out more about eBird at their website.
Installation
You can install the stable version from CRAN
install.packages("rebird")Or the development version from Github
install.packages("devtools")
devtools::install_github("ropensci/rebird")Then load the package into the R session
Usage
The eBird
API server requires users to provide an API key, which is linked to
your eBird user account. You can pass it to the ‘key’ argument in
rebird functions, but we highly recommend storing it as an
environment variable called EBIRD_KEY in your .Renviron file. If you
don’t have a key, you can obtain one from https://ebird.org/api/keygen.
You can keep your .Renviron file in your global R home directory
(R.home()), your user’s home directory
(Sys.getenv("HOME")), or your current working directory
(getwd()). Remember that .Renviron is loaded once when you
start R, so if you add your API key to the file you will have to restart
your R session. See ?Startup for more information on R’s
startup files.
Furthermore, functions now use species codes, rather than scientific
names, for species-specific requests. We’ve made the switch easy by
providing the species_code function, which converts a
scientific name to its species code:
species_code('sula variegata')## Peruvian Booby (Sula variegata): perboo1
## [1] "perboo1"
The species_code function can be called within other
rebird functions, or the species code can be specified
directly.
eBird Taxonomy
The eBird taxonomy is internally stored in rebird and
can be called using
rebird::tax## # A tibble: 18,631 × 15
## sciName comName speciesCode category
## <chr> <chr> <chr> <chr>
## 1 Struth… Common… ostric2 species
## 2 Struth… Somali… ostric3 species
## 3 Struth… Common… y00934 slash
## 4 Casuar… Southe… soucas1 species
## 5 Casuar… Dwarf … dwacas1 species
## 6 Casuar… Northe… norcas1 species
## 7 Dromai… Emu emu1 species
## 8 Aptery… Southe… sobkiw1 species
## 9 Aptery… Southe… sobkiw2 issf
## 10 Aptery… Southe… sobkiw3 issf
## # ℹ 18,621 more rows
## # ℹ 11 more variables:
## # taxonOrder <dbl>,
## # bandingCodes <chr>,
## # comNameCodes <chr>,
## # sciNameCodes <chr>, order <chr>,
## # familyCode <chr>, …
While the internal taxonomy is kept up to date with each package release, it could be outdated if a new taxonomy is made available before the package is updated. You can obtain the latest eBird taxonomy by
new_tax <- ebirdtaxonomy()Sightings at location determined by latitude/longitude
Search for bird occurrences by latitude and longitude point
ebirdgeo(species = species_code('spinus tristis'), lat = 42, lng = -76)## American Goldfinch (Spinus tristis): amegfi
## # A tibble: 32 × 13
## speciesCode comName sciName locId
## <chr> <chr> <chr> <chr>
## 1 amegfi American … Spinus… L982…
## 2 amegfi American … Spinus… L101…
## 3 amegfi American … Spinus… L292…
## 4 amegfi American … Spinus… L209…
## 5 amegfi American … Spinus… L447…
## 6 amegfi American … Spinus… L186…
## 7 amegfi American … Spinus… L325…
## 8 amegfi American … Spinus… L185…
## 9 amegfi American … Spinus… L505…
## 10 amegfi American … Spinus… L197…
## # ℹ 22 more rows
## # ℹ 9 more variables: locName <chr>,
## # obsDt <chr>, howMany <int>,
## # lat <dbl>, lng <dbl>,
## # obsValid <lgl>, obsReviewed <lgl>,
## # locationPrivate <lgl>, subId <chr>
Recent observations at a region
Search for bird occurrences by region and species name
ebirdregion(loc = 'US', species = 'btbwar')## # A tibble: 33 × 13
## speciesCode comName sciName locId
## <chr> <chr> <chr> <chr>
## 1 btbwar Black-thr… Setoph… L113…
## 2 btbwar Black-thr… Setoph… L801…
## 3 btbwar Black-thr… Setoph… L582…
## 4 btbwar Black-thr… Setoph… L423…
## 5 btbwar Black-thr… Setoph… L127…
## 6 btbwar Black-thr… Setoph… L431…
## 7 btbwar Black-thr… Setoph… L142…
## 8 btbwar Black-thr… Setoph… L278…
## 9 btbwar Black-thr… Setoph… L797…
## 10 btbwar Black-thr… Setoph… L502…
## # ℹ 23 more rows
## # ℹ 9 more variables: locName <chr>,
## # obsDt <chr>, howMany <int>,
## # lat <dbl>, lng <dbl>,
## # obsValid <lgl>, obsReviewed <lgl>,
## # locationPrivate <lgl>, subId <chr>
Recent observations at hotspots
Search for bird occurrences by a given hotspot
ebirdregion(loc = 'L99381')## # A tibble: 74 × 14
## speciesCode comName sciName locId
## <chr> <chr> <chr> <chr>
## 1 cangoo Canada Go… Branta… L993…
## 2 mallar3 Mallard Anas p… L993…
## 3 redhea Redhead Aythya… L993…
## 4 rinduc Ring-neck… Aythya… L993…
## 5 gresca Greater S… Aythya… L993…
## 6 lessca Lesser Sc… Aythya… L993…
## 7 buffle Bufflehead Buceph… L993…
## 8 commer Common Me… Mergus… L993…
## 9 y00475 American … Fulica… L993…
## 10 ribgul Ring-bill… Larus … L993…
## # ℹ 64 more rows
## # ℹ 10 more variables: locName <chr>,
## # obsDt <chr>, howMany <int>,
## # lat <dbl>, lng <dbl>,
## # obsValid <lgl>, obsReviewed <lgl>,
## # locationPrivate <lgl>,
## # subId <chr>, …
Nearest observations of a species
Search for a species’ occurrences near a given latitude and longitude
nearestobs(species_code('branta canadensis'), 42, -76)## Canada Goose (Branta canadensis): cangoo
## # A tibble: 23 × 13
## speciesCode comName sciName locId
## <chr> <chr> <chr> <chr>
## 1 cangoo Canada Go… Branta… L174…
## 2 cangoo Canada Go… Branta… L100…
## 3 cangoo Canada Go… Branta… L116…
## 4 cangoo Canada Go… Branta… L186…
## 5 cangoo Canada Go… Branta… L217…
## 6 cangoo Canada Go… Branta… L355…
## 7 cangoo Canada Go… Branta… L501…
## 8 cangoo Canada Go… Branta… L447…
## 9 cangoo Canada Go… Branta… L113…
## 10 cangoo Canada Go… Branta… L145…
## # ℹ 13 more rows
## # ℹ 9 more variables: locName <chr>,
## # obsDt <chr>, howMany <int>,
## # lat <dbl>, lng <dbl>,
## # obsValid <lgl>, obsReviewed <lgl>,
## # locationPrivate <lgl>, subId <chr>
Recent notable sightings
Search for notable sightings at a given latitude and longitude
ebirdnotable(lat = 42, lng = -70)## # A tibble: 2,821 × 14
## speciesCode comName sciName locId
## <chr> <chr> <chr> <chr>
## 1 laugul Laughing … Leucop… L801…
## 2 whiibi White Ibis Eudoci… L801…
## 3 chiswi Chimney S… Chaetu… L983…
## 4 eurwig Eurasian … Mareca… L452…
## 5 eurwig Eurasian … Mareca… L452…
## 6 rehwoo Red-heade… Melane… L801…
## 7 treswa Tree Swal… Tachyc… L838…
## 8 clcspa Clay-colo… Spizel… L276…
## 9 clcspa Clay-colo… Spizel… L276…
## 10 redhea Redhead Aythya… L241…
## # ℹ 2,811 more rows
## # ℹ 10 more variables: locName <chr>,
## # obsDt <chr>, howMany <int>,
## # lat <dbl>, lng <dbl>,
## # obsValid <lgl>, obsReviewed <lgl>,
## # locationPrivate <lgl>,
## # subId <chr>, …
or a region
ebirdnotable(locID = 'US-NY-109')## # A tibble: 20 × 13
## speciesCode comName sciName locId
## <chr> <chr> <chr> <chr>
## 1 rehwoo Red-heade… Melane… L293…
## 2 x01134 American … Larus … L212…
## 3 fiespa Field Spa… Spizel… L353…
## 4 x01134 American … Larus … L212…
## 5 x01134 American … Larus … L996…
## 6 redcro Red Cross… Loxia … L357…
## 7 easpho Eastern P… Sayorn… L798…
## 8 easpho Eastern P… Sayorn… L523…
## 9 x01134 American … Larus … L212…
## 10 x01134 American … Larus … L212…
## 11 comyel Common Ye… Geothl… L266…
## 12 fiespa Field Spa… Spizel… L266…
## 13 chispa Chipping … Spizel… L431…
## 14 chispa Chipping … Spizel… L431…
## 15 x01134 American … Larus … L212…
## 16 redcro Red Cross… Loxia … L123…
## 17 chispa Chipping … Spizel… L111…
## 18 amewoo American … Scolop… L277…
## 19 x01134 American … Larus … L212…
## 20 x01134 American … Larus … L212…
## # ℹ 9 more variables: locName <chr>,
## # obsDt <chr>, howMany <int>,
## # lat <dbl>, lng <dbl>,
## # obsValid <lgl>, obsReviewed <lgl>,
## # locationPrivate <lgl>, subId <chr>
Historic Observations
Obtain a list of species reported on a specific date in a given region
ebirdhistorical(loc = 'US-VA-003', date = '2019-02-14',max = 10)## # A tibble: 10 × 13
## speciesCode comName sciName locId
## <chr> <chr> <chr> <chr>
## 1 cangoo Canada Go… Branta… L139…
## 2 mallar3 Mallard Anas p… L139…
## 3 gnwtea Green-win… Anas c… L139…
## 4 killde Killdeer Charad… L139…
## 5 baleag Bald Eagle Haliae… L139…
## 6 belkin1 Belted Ki… Megace… L139…
## 7 carwre Carolina … Thryot… L139…
## 8 whtspa White-thr… Zonotr… L139…
## 9 norcar Northern … Cardin… L139…
## 10 canvas Canvasback Aythya… L331…
## # ℹ 9 more variables: locName <chr>,
## # obsDt <chr>, howMany <int>,
## # lat <dbl>, lng <dbl>,
## # obsValid <lgl>, obsReviewed <lgl>,
## # locationPrivate <lgl>, subId <chr>
or a hotspot
ebirdhistorical(loc = 'L196159', date = '2019-02-14', fieldSet = 'full')## # A tibble: 14 × 27
## speciesCode comName sciName locId
## <chr> <chr> <chr> <chr>
## 1 annhum Anna's Hu… Calypt… L196…
## 2 ribgul Ring-bill… Larus … L196…
## 3 glwgul Glaucous-… Larus … L196…
## 4 amecro American … Corvus… L196…
## 5 bkcchi Black-cap… Poecil… L196…
## 6 bushti Bushtit Psaltr… L196…
## 7 pacwre1 Pacific W… Nannus… L196…
## 8 houfin House Fin… Haemor… L196…
## 9 purfin Purple Fi… Haemor… L196…
## 10 amegfi American … Spinus… L196…
## 11 daejun Dark-eyed… Junco … L196…
## 12 sonspa Song Spar… Melosp… L196…
## 13 spotow Spotted T… Pipilo… L196…
## 14 rewbla Red-winge… Agelai… L196…
## # ℹ 23 more variables: locName <chr>,
## # obsDt <chr>, howMany <int>,
## # lat <dbl>, lng <dbl>,
## # obsValid <lgl>, obsReviewed <lgl>,
## # locationPrivate <lgl>,
## # subId <chr>,
## # subnational2Code <chr>, …
Information on a given region or hotspot
Obtain detailed information on any valid eBird region
ebirdregioninfo("CA-BC-GV")## # A tibble: 1 × 5
## region minX maxX minY maxY
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 Metro Vancou… -123. -122. 49.0 49.6
or hotspot
ebirdregioninfo("L196159")## # A tibble: 1 × 16
## locId name latitude longitude
## <chr> <chr> <dbl> <dbl>
## 1 L196159 Vancouver… 49.3 -123.
## # ℹ 12 more variables:
## # countryCode <chr>,
## # countryName <chr>,
## # subnational1Name <chr>,
## # subnational1Code <chr>,
## # subnational2Code <chr>,
## # subnational2Name <chr>, …
Obtain a list of eBird species codes for all species recorded in a region
ebirdregionspecies("GB-ENG-LND")## # A tibble: 406 × 1
## speciesCode
## <chr>
## 1 wfwduc1
## 2 fuwduc
## 3 bahgoo
## 4 empgoo
## 5 snogoo
## 6 rosgoo
## 7 gragoo
## 8 swagoo1
## 9 x00776
## 10 gwfgoo
## # ℹ 396 more rows
or a hotspot
ebirdregionspecies("L5803024")## # A tibble: 192 × 1
## speciesCode
## <chr>
## 1 gragoo
## 2 gwfgoo
## 3 tunbeg1
## 4 pifgoo
## 5 bargoo
## 6 cangoo
## 7 x00758
## 8 mutswa
## 9 tunswa
## 10 whoswa
## # ℹ 182 more rows
Obtain a list of all subregions within an eBird region
ebirdsubregionlist("subnational1","US")## # A tibble: 51 × 2
## code name
## <chr> <chr>
## 1 US-AL Alabama
## 2 US-AK Alaska
## 3 US-AZ Arizona
## 4 US-AR Arkansas
## 5 US-CA California
## 6 US-CO Colorado
## 7 US-CT Connecticut
## 8 US-DE Delaware
## 9 US-DC District of Columbia
## 10 US-FL Florida
## # ℹ 41 more rows
Checklist Feed
Obtain a list of checklists submitted on a given date at a region or hotspot
ebirdchecklistfeed(loc = "L207391", date = "2020-03-24", max = 5)## # A tibble: 5 × 9
## locId subId userDisplayName
## <chr> <chr> <chr>
## 1 L207391 S66174580 David Wood
## 2 L207391 S66173590 Sofia Prado-Irwin
## 3 L207391 S66194110 Jeffrey Gantz
## 4 L207391 S66171158 Ann Gurka
## 5 L207391 S70981564 Barbara Olson
## # ℹ 6 more variables:
## # numSpecies <int>, obsDt <chr>,
## # obsTime <chr>, isoObsDate <chr>,
## # subID <chr>, loc <chr>
View Checklist
Obtain all information on a specific checklist
ebirdchecklist("S139153079")## # A tibble: 99 × 25
## subId protocolId locId groupId
## <chr> <chr> <chr> <chr>
## 1 S139153079 P22 L17 G103108…
## 2 S139153079 P22 L17 G103108…
## 3 S139153079 P22 L17 G103108…
## 4 S139153079 P22 L17 G103108…
## 5 S139153079 P22 L17 G103108…
## 6 S139153079 P22 L17 G103108…
## 7 S139153079 P22 L17 G103108…
## 8 S139153079 P22 L17 G103108…
## 9 S139153079 P22 L17 G103108…
## 10 S139153079 P22 L17 G103108…
## # ℹ 89 more rows
## # ℹ 21 more variables:
## # durationHrs <dbl>,
## # allObsReported <lgl>,
## # subComments <chr>,
## # creationDt <chr>,
## # lastEditedDt <chr>, obsDt <chr>, …
Hotspots in a region or nearby coordinates
Obtain a list of hotspots within a region
ebirdhotspotlist("CA-NS-HL")## # A tibble: 313 × 10
## locId locName countryCode
## <chr> <chr> <chr>
## 1 L2334369 Abraham Lake … CA
## 2 L7003818 Admiral Cove … CA
## 3 L1765807 Admiral Lake … CA
## 4 L12227034 Armdale--Crow… CA
## 5 L12690538 Armdale--Hail… CA
## 6 L2390509 Bald Rock Rd. CA
## 7 L7598385 Bayers Lake, … CA
## 8 L11019120 Beaver Bank Q… CA
## 9 L1872934 Bedford Basin CA
## 10 L12134597 Bedford--Andr… CA
## # ℹ 303 more rows
## # ℹ 7 more variables:
## # subnational1Code <chr>,
## # subnational2Code <chr>, lat <dbl>,
## # lng <dbl>, latestObsDt <chr>,
## # numSpeciesAllTime <int>,
## # numChecklistsAllTime <int>
or within a radius of up to 50 kilometers, from a given set of coordinates.
ebirdhotspotlist(lat = 30, lng = -90, dist = 10)## No region code provided, locating hotspots using lat/lng
## # A tibble: 56 × 10
## locId locName countryCode
## <chr> <chr> <chr>
## 1 L6025517 Algiers Point US
## 2 L3886471 Armstrong Par… US
## 3 L727179 Audubon Louis… US
## 4 L6665071 BAEA Nest--Pa… US
## 5 L6666949 BAEA Nest--Wa… US
## 6 L50491229 Bayou Bienven… US
## 7 L2423926 Bayou Bienven… US
## 8 L725034 Bayou Sauvage… US
## 9 L37730406 Bayou Sauvage… US
## 10 L727232 Chalmette Bat… US
## # ℹ 46 more rows
## # ℹ 7 more variables:
## # subnational1Code <chr>,
## # subnational2Code <chr>, lat <dbl>,
## # lng <dbl>, latestObsDt <chr>,
## # numSpeciesAllTime <int>,
## # numChecklistsAllTime <int>