/
README.Rmd
118 lines (84 loc) · 3.33 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
rvertnet
=======
```{r echo=FALSE}
knitr::opts_chunk$set(
warning = FALSE,
message = FALSE,
collapse = TRUE,
comment = "#>"
)
```
[![Build Status](https://travis-ci.org/ropensci/rvertnet.svg?branch=master)](https://travis-ci.org/ropensci/rvertnet)
[![Build status](https://ci.appveyor.com/api/projects/status/duyrffhdrstu840v?svg=true)](https://ci.appveyor.com/project/sckott/rvertnet)
[![codecov.io](https://codecov.io/github/ropensci/rvertnet/coverage.svg?branch=master)](https://codecov.io/github/ropensci/rvertnet?branch=master)
[![rstudio mirror downloads](http://cranlogs.r-pkg.org/badges/grand-total/rvertnet?color=2ECC71)](https://github.com/metacran/cranlogs.app)
[![cran version](http://www.r-pkg.org/badges/version/rvertnet)](https://cran.r-project.org/package=rvertnet)
`rvertnet` is a client for interacting with [VertNet.org](http://vertnet.org/).
VertNet.org API docs: [github.com/VertNet/webapp/wiki/The-API-search-function](https://github.com/VertNet/webapp/wiki/The-API-search-function)
## Installation
Stable CRAN version
```{r eval=FALSE}
install.packages("rvertnet")
```
Or development version from GitHub
```{r eval=FALSE}
install.packages("devtools")
devtools::install_github("ropensci/rvertnet")
```
```{r}
library('rvertnet')
```
## Search by term
Search for _Aves_ in the state of _California_, limit to 10 records
```{r}
res <- searchbyterm(class = "Aves", state = "California", lim = 10, verbose = FALSE)
```
Inspect metadata
```{r}
res$meta
```
Inspect data. A `dplyr` data.frame is given back, so you get a nice brief data summary:
```{r}
res$data[,1:5]
```
Search for _Mustela nigripes_ in the states of _Wyoming_ or _South Dakota_, limit to 20 records
```{r}
res <- searchbyterm(specificepithet = "nigripes", state = "(wyoming OR south dakota)", limit = 20, verbose = FALSE)
res$data[,1:5]
```
### dplyr downstream
You can pass the data object directly on to `dplyr` functions. Here, we get a table of record counts by species in descending order.
```{r}
library("dplyr")
out <- searchbyterm(genus = "Ochotona", limit = 800)
out$data %>%
group_by(scientificname) %>%
summarise(count = length(scientificname)) %>%
arrange(desc(count))
```
## Big data
Specifies a termwise search (like `searchbyterm()`), but requests that all available records be made available for download as a tab-delimited text file.
```{r eval=FALSE}
bigsearch(genus = "ochotona", rf = "pikaRecords", email = "big@@search.luv")
#> Processing request...
#>
#> Download of records file 'mydata' requested for 'you@gmail.com'
#>
#> Query/URL: "http://api.vertnet-portal.appspot.com/api/download?q=%7B%22q%22:%22genus:ochotona%22,%22n%22:%22mydata%22,%22e%22:%22you@gmail.com%22%7D"
#>
#> Thank you! Download instructions will be sent by email.
```
## Spatial search
```{r}
res <- spatialsearch(lat = 33.529, lon = -105.694, radius = 2000, limit = 10, verbose = FALSE)
res$data[,1:5]
```
## Contributors
* Scott Chamberlain [@sckott](https://github.com/sckott)
* Chris Ray [@Pika8tona](https://github.com/Pika8tona)
* Vijay Barve [@vijaybarve](https://github.com/vijaybarve)
## Meta
* Please [report any issues or bugs](https://github.com/ropensci/rvertnet/issues).
* License: MIT
* Get citation information for `rvertnet` in R doing `citation(package = 'rvertnet')`
[![ropensci_footer](http://ropensci.org/public_images/github_footer.png)](http://ropensci.org)