forked from ropensci/rebird
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
226 lines (150 loc) · 7.35 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
# rebird: wrapper to the eBird API
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active)
[![Build Status](https://api.travis-ci.org/ropensci/rebird.png)](https://travis-ci.org/ropensci/rebird)
[![Build status](https://ci.appveyor.com/api/projects/status/s3dobn991c20t2kg?svg=true)](https://ci.appveyor.com/project/sckott/rebird)
[![cran checks](https://cranchecks.info/badges/worst/rebird)](https://cranchecks.info/pkgs/rebird)
[![Coverage Status](https://coveralls.io/repos/ropensci/rebird/badge.svg)](https://coveralls.io/r/ropensci/rebird)
[![rstudio mirror downloads](http://cranlogs.r-pkg.org/badges/rebird)](https://github.com/metacran/cranlogs.app)
[![cran version](http://www.r-pkg.org/badges/version/rebird)](https://cran.r-project.org/package=rebird/)
`rebird` is a package to interface with the eBird webservices.
eBird is a real-time, online bird checklist program. For more information, visit their website: http://www.ebird.org
The API for the eBird webservices can be accessed here: https://documenter.getpostman.com/view/664302/ebird-api-20/2HTbHW
## Install
You can install the stable version from CRAN
```{r eval=FALSE}
install.packages("rebird")
```
Or the development version from Github
```{r eval=FALSE}
install.packages("devtools")
devtools::install_github("ropensci/rebird")
```
# Direct use of `rebird`
Load the package:
```{r}
library("rebird")
```
The [eBird API server](https://documenter.getpostman.com/view/664302/ebird-api-20/2HTbHW)
has been updated and thus there are a couple major changes in the way `rebird` works.
API requests to eBird now require 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 <https://csgillespie.github.io/efficientR/r-startup.html> 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:
```{r speciescode}
species_code('sula variegata')
```
The `species_code` function can be called within other `rebird` functions, or the species code
can be specified directly.
## Sightings at location determined by latitude/longitude
Search for bird occurrences by latitude and longitude point
```{r ebirdgeo1}
ebirdgeo(species = species_code('spinus tristis'), lat = 42, lng = -76)
```
## Recent observations at a region
Search for bird occurrences by region and species name
```{r ebirdregion1}
ebirdregion(loc = 'US', species = 'btbwar')
```
## Recent observations at hotspots
Search for bird occurrences by a given hotspot
```{r ebirdhotspot}
ebirdregion(loc = 'L99381')
```
## Nearest observations of a species
Search for a species' occurrences near a given latitude and longitude
```{r nearestobs}
nearestobs(species_code('branta canadensis'), 42, -76)
```
## Frequency of observations at hotspots or regions
Obtain historical frequencies of bird occurrences by hotspot or region
```{r ebirdfreq}
ebirdfreq(loctype = 'hotspots', loc = 'L196159')
```
## Recent notable sightings
Search for notable sightings at a given latitude and longitude
```{r ebirdnotable1}
ebirdnotable(lat = 42, lng = -70)
```
or a region
```{r ebirdnotable2}
ebirdnotable(locID = 'US-NY-109')
```
## Historic Observations
Search for historic observations on a date at a region
```{r ebirdhistorical1}
ebirdhistorical(loc = 'US-VA-003', date = '2019-02-14',max = 10)
```
or a hotspot
```{r ebirdhistorical2}
ebirdhistorical(loc = 'L196159', date = '2019-02-14', fieldSet = 'full')
```
## Information on a given region or hotspot
Obtain detailed information on any valid eBird region
```{r ebirdregioninfo1}
ebirdregioninfo("CA-BC-GV")
```
or hotspot
```{r ebirdregioninfo2}
ebirdregioninfo("L196159")
```
## `rebird` and other packages
### How to use `rebird`
This package is part of a richer suite called [spocc - Species Occurrence Data](https://github.com/ropensci/spocc), along with several other packages, that provide access to occurrence records from multiple databases. We recommend using `spocc` as the primary R interface to `rebird` unless your needs are limited to this single source.
### `auk` vs. `rebird`
Those interested in eBird data may also want to consider [`auk`](https://github.com/CornellLabofOrnithology/auk), an R package that helps extracting and processing the whole eBird dataset. The functions in `rebird` are faster but mostly limited to accessing recent (i.e. within the last 30 days) observations, although `ebirdfreq()` does provide historical frequency of observation data. In contrast, `auk` gives access to the full set of ~ 500 million eBird observations. For most ecological applications, users will require `auk`; however, for some use cases, e.g. building tools for birders, `rebird` provides a quicker and easier way to access data. `rebird` and `auk` are both part of the rOpenSci project.
## API requests covered by `rebird`
The 2.0 APIs have considerably been expanded from the previous version, and `rebird` only covers some of them. The webservices covered are listed below; if you'd like to contribute wrappers to APIs not yet covered by this package, feel free to submit a pull request!
### data/obs
- [x] Recent observations in a region: `ebirdregion()`
- [x] Recent notable observations in a region: `ebirdnotable()`
- [x] Recent observations of a species in a region: `ebirdregion()`
- [x] Recent nearby observations: `ebirdgeo()`
- [x] Recent nearby observations of a species: `ebirdgeo()`
- [x] Nearest observations of a species: `nearestobs()`
- [x] Recent nearby notable observations: `ebirdnotable()`
- [x] Historic observations on a date: `ebirdhistorical()`
### product
- [ ] Top 100
- [ ] Checklist feed on a date
- [ ] Recent checklists feed
- [ ] Regional statistics on a date
- [ ] View Checklist BETA
### ref/geo
- [ ] Adjacent Regions
### ref/hotspot
- [ ] Hotspots in a region
- [ ] Nearby hotspots
### ref/taxonomy
- [x] eBird Taxonomy: `ebirdtaxonomy()`
- [ ] Taxonomic Forms
- [ ] Taxonomy Versions
- [ ] Taxonomic Groups
### ref/region
- [x] Hotspot Info: `ebirdregioninfo()`
- [x] Region Info: `ebirdregioninfo()`
- [ ] Sub Region List
## Meta
* Please [report any issues or bugs](https://github.com/ropensci/rebird/issues).
* License: MIT
* Get citation information for `rebird` in R doing `citation(package = 'rebird')`
[![ropensci_footer](http://ropensci.org/public_images/github_footer.png)](http://ropensci.org)