Search 'Vertnet', a 'Database' of Vertebrate Specimen Records

Retrieve, map and summarize data from the 'VertNet.org' archives. Functions allow searching by many parameters, including 'taxonomic' names, places, and dates. In addition, there is an interface for conducting spatially delimited searches, and another for requesting large 'datasets' via email.


Build Status Build status codecov.io rstudio mirror downloads cran version

rvertnet is a client for interacting with VertNet.org.

VertNet.org API docs: https://github.com/VertNet/webapp/wiki/The-API-search-function

Stable CRAN version

install.packages("rvertnet")

Or development version from GitHub

install.packages("devtools")
devtools::install_github("ropensci/rvertnet")
library('rvertnet')

Search by term

Search for Aves in the state of California, limit to 10 records

res <- searchbyterm(class = "Aves", state = "California", lim = 10, verbose = FALSE)

Inspect metadata

res$meta
#> $request_date
#> [1] "2017-08-14T21:55:09.833740"
#>
#> $response_records
#> [1] 10
#>
#> $submitted_query
#> [1] "class:Aves stateprovince:California"
#>
#> $request_origin
#> [1] "45.523452,-122.676207"
#>
#> $limit
#> [1] 10
#>
#> $last_cursor
#> [1] "False:Cu8GCsoECpwE9wAAABn_____jIGJmo2LkZqL0o-QjYuek96WkZuah9LNz87M0s_H0s_H_wAA_3RtoKCZi4ygoP8AAP9dno-PmpGYlpGa_wAA_3N0bZaRm5qH_wAA_12biJz_AAD_c3Rtm5CcoJab_wAA_12cipKJ0J2WjZvSjI-anJaSmpGM0JeLi4_Sno2ci5CM0puei56dnoya0pKKjJqKktKYipab0pyKkonSnZaNm9LLy87JydKMmpab0s3Mz8zMxsj_AAD_c3-cipKJ0J2WjZvSjI-anJaSmpGM0JeLi4_Sno2ci5CM0puei56dnoya0pKKjJqKktKYipab0pyKkonSnZaNm9LLy87JydKMmpab0s3Mz8zMxsj_AAD__wD-__6MgYmajYuRmovSj5CNi56T3paRm5qH0s3PzszSz8fSz8f_AHRtoKCZi4ygoP8AXZ6Pj5qRmJaRmv8Ac3RtlpGbmof_AF2biJz_AHN0bZuQnKCWm_8AXZyKkonQnZaNm9KMj5qclpKakYzQl4uLj9KejZyLkIzSm56Lnp2ejJrSkoqMmoqS0piKlpvSnIqSidKdlo2b0svLzsnJ0oyalpvSzczPzMzGyP8Ac3-cipKJ0J2WjZvSjI-anJaSmpGM0JeLi4_Sno2ci5CM0puei56dnoya0pKKjJqKktKYipab0pyKkonSnZaNm9LLy87JydKMmpab0s3Mz8zMxsj_AP_-EAohBN0EkB08Gxk5AAAAAOb___9IClAAWgsJ4h5N-19FzJ8QAmDc4-iNBRINRG9jdW1lbnRJbmRleBruAShBTkQgKElTICJjdXN0b21lcl9uYW1lIiAiYXBwZW5naW5lIikgKElTICJncm91cF9uYW1lIiAic352ZXJ0bmV0LXBvcnRhbCIpIChJUyAibmFtZXNwYWNlIiAiaW5kZXgtMjAxMy0wOC0wOCIpIChJUyAiaW5kZXhfbmFtZSIgImR3YyIpIChBTkQgKE9SIChRVCAiQXZlcyIgInJ0ZXh0X2NsYXNzIikgKElTICJyYXRvbV9jbGFzcyIgImF2ZXMiKSkgKFFUICJDYWxpZm9ybmlhIiAicnRleHRfc3RhdGVwcm92aW5jZSIpKSk6GQoMKE4gb3JkZXJfaWQpEAEZAAAAAAAA8P9KBQgAQOgH"
#>
#> $query_version
#> [1] "search.py 2016-08-15T16:43+02:00"
#>
#> $matching_records
#> [1] ">10000"
#>
#> $api_version
#> [1] "api.py 2017-01-12T20:08-03:00"

Inspect data. A dplyr data.frame is given back, so you get a nice brief data summary:

res$data[,1:5]
#> # A tibble: 10 x 5
#>                 modified language license
#>                    <chr>    <chr>   <chr>
#>  1            2015-01-06       en    CCBY
#>  2            2015-01-06       en    CCBY
#>  3            2015-01-06       en    CCBY
#>  4 2015-08-26 13:10:07.0       en     CC0
#>  5 2015-08-26 13:10:07.0       en     CC0
#>  6 2015-08-26 13:10:07.0       en     CC0
#>  7 2015-08-26 13:10:07.0       en     CC0
#>  8 2016-05-18 09:27:29.0       en     CC0
#>  9 2016-05-18 09:27:29.0       en     CC0
#> 10 2016-05-18 09:27:29.0       en     CC0
#> # ... with 2 more variables: accessrights <chr>,
#> #   bibliographiccitation <chr>

Search for Mustela nigripes in the states of Wyoming or South Dakota, limit to 20 records

res <- searchbyterm(specificepithet = "nigripes", state = "(wyoming OR south dakota)", limit = 20, verbose = FALSE)
res$data[,1:5]
#> # A tibble: 19 x 5
#>                 modified language license
#>                    <chr>    <chr>   <chr>
#>  1 2010-01-14 13:06:23.0       en   CC-BY
#>  2 2011-11-17 12:02:57.0       en     CC0
#>  3            2013-08-07       en    <NA>
#>  4 2015-11-23 09:17:09.0       en     CC0
#>  5 2016-02-01 17:40:23.0       en     CC0
#>  6 2016-04-12 00:24:00.0       en     CC0
#>  7            2016-11-15       en     CC0
#>  8                  <NA>     <NA>     CC0
#>  9                  <NA>     <NA>     CC0
#> 10                  <NA>     <NA>     CC0
#> 11                  <NA>     <NA>     CC0
#> 12                  <NA>     <NA>     CC0
#> 13                  <NA>     <NA>     CC0
#> 14                  <NA>     <NA>     CC0
#> 15                  <NA>     <NA>     CC0
#> 16                  <NA>     <NA>     CC0
#> 17                  <NA>     <NA>     CC0
#> 18                  <NA>     <NA>     CC0
#> 19                  <NA>     <NA>     CC0
#> # ... with 2 more variables: accessrights <chr>,
#> #   bibliographiccitation <chr>

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.

library("dplyr")
out <- searchbyterm(genus = "Ochotona", limit = 800)
out$data %>%
  group_by(scientificname) %>%
  summarise(count = length(scientificname)) %>%
  arrange(desc(count))
#> # A tibble: 28 x 2
#>                               scientificname count
#>                                        <chr> <int>
#>  1                         Ochotona princeps   284
#>  2               Ochotona princeps saxatilis   202
#>  3                          Ochotona pallasi   132
#>  4                   Ochotona princeps muiri    43
#>  5                       Ochotona hyperborea    39
#>  6                         Ochotona dauurica    21
#>  7 Ochotona (Pika) princeps Richardson, 1828    20
#>  8                Ochotona princeps figginsi    13
#>  9              Ochotona princeps nevadensis     8
#> 10                           Ochotona alpina     4
#> # ... with 18 more rows

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.

bigsearch(genus = "ochotona", rf = "pikaRecords", email = "[email protected]@search.luv")
#> Processing request...
#>
#> Download of records file 'mydata' requested for '[email protected]'
#>
#> Query/URL: "http://api.vertnet-portal.appspot.com/api/download?q=%7B%22q%22:%22genus:ochotona%22,%22n%22:%22mydata%22,%22e%22:%[email protected]%22%7D"
#>
#> Thank you! Download instructions will be sent by email.

Spatial search

res <- spatialsearch(lat = 33.529, lon = -105.694, radius = 2000, limit = 10, verbose = FALSE)
res$data[,1:5]
#> # A tibble: 10 x 5
#>                 modified language                            accessrights
#>                    <chr>    <chr>                                   <chr>
#>  1 2014-09-09 14:04:14.0       en http://vertnet.org/resources/norms.html
#>  2 2015-08-03 19:48:08.0       en http://vertnet.org/resources/norms.html
#>  3 2015-08-03 19:48:08.0       en http://vertnet.org/resources/norms.html
#>  4 2015-08-03 19:48:08.0       en http://vertnet.org/resources/norms.html
#>  5 2015-08-03 19:48:08.0       en http://vertnet.org/resources/norms.html
#>  6 2015-08-03 19:48:08.0       en http://vertnet.org/resources/norms.html
#>  7 2015-08-03 19:48:08.0       en http://vertnet.org/resources/norms.html
#>  8 2015-08-03 19:48:08.0       en http://vertnet.org/resources/norms.html
#>  9 2015-08-03 19:48:08.0       en http://vertnet.org/resources/norms.html
#> 10 2015-08-03 19:48:08.0       en http://vertnet.org/resources/norms.html
#> # ... with 2 more variables: bibliographiccitation <chr>, references <chr>

Contributors

Meta

  • Please report any issues or bugs.
  • License: MIT
  • Get citation information for rvertnet in R doing citation(package = 'rvertnet')
  • Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

News

rvertnet 0.6.2

BUG FIXES

  • A small data source used in one function was on the web, and was moved - that data source now within the pkg as quite small, and now pkg won't break when the file is moved again (#61) (#62)

rvertnet 0.6.0

Added Code of Conduct.

NEW FEATURES

  • Now using crul package for HTTP requests instead of httr (#57)
  • Note that verbose parameter has been replaced with messages throughout the package.
  • Now with function for search for trait data: traitsearch() (#55)

DEFUNCT AND DEPRECATED

  • All dump functions are now defunct. Those functions tried to help users work with bulk Vertnet data - the setup has gotten too complex (#56)

MINOR IMPROVEMENTS

  • Improvements to documentation for traitsearch() function on what fields have given data (#58) thanks @gaurav
  • vertsearch() and searchbyterm() gain new parameter only_dwc, which allows to optionally only return Darwin Core fields

BUG FIXES

  • Small fix to vertsummary() (#59)

rvertnet 0.5.0

NEW FEATURES

  • searchbyterm() gains new parameter query to allow full text search, much like vertsearch(), but with the ability to also use all the parameters available in searchbyterm() (#53)

MINOR IMPROVEMENTS

  • Use dplyr::bind_rows instead of the deprecated dplyr::rbind_all (#51)
  • remove personal email address from tests (#52)
  • Namespace base R pkg fxn calls (methods/stats/utils), and removed some package dependencies that we didn't really need (plyr) (#54)

rvertnet 0.4.4

MINOR IMPROVEMENTS

  • Updated docs to better indicate how to use the cursor feature (#49)
  • Now using explicit encoding specification when using httr::content() (#47)

BUG FIXES

  • Fixed externalptr error in the internal vert_GET() function (#48)

rvertnet 0.4.1

BUG FIXES

  • Fixed a bug in bigsearch() in which we had forgotten to do internal conversion of logical input to 0/1 needed by the web API (#46)

rvertnet 0.4.0

NEW FEATURES

  • New set of functions to make working with VertNet data dumps easier. dump_links() gives you links to various data dump resources; dump_init() initialized a SQLite database connection; dump_tbl() creates a dplyr::tbl object, which can then be used in a dplyr query. This setup requires that the user manually download data dumps uncompress, and load into SQLite. We hope to make this process easier in the future. (#36)

MINOR IMPROVEMENTS

  • Fixes to vertmap() for new ggplot2 version (#43)
  • Added note to docs for bigsearch() for how to read in data after obtaining the data (#44)

BUG FIXES

  • Fix to the searchbyterm() function. When the parameter stateprovince was used, lead to error, as that param requires different handling than other params. (#45)

rvertnet 0.3.4

NEW FEATURES

  • New function vert_id() to get occurrence records by occurenceid, that is, single occurrence ids. (#40)

MINOR IMPROVEMENTS

  • Explicitly import non-base R functions (#39)

BUG FIXES

  • Lowercase occurenceID to occurrenceid to simplify life (#41)

rvertnet 0.3.0

NEW FEATURES

  • searchbyterm() and bigsearch() have some parameters that accept multiple values. Fixed to allow this (#37)
  • Internals of searchbyterm(), spatialsearch(), and vertsearch() reworked to use cursor so we internally do paging for you for bigger result sets. (#25)

MINOR IMPROVEMENTS

  • Replaced data.table import with dplyr
  • Using skip_on_cran() (#38)
  • Minor vignette updates (#35)
  • Metadata now returned in data requests (#33)

rvertnet 0.2.2

Package completely reworked for the new VertNet API.

NEW FEATURES

  • The functions vertavailablemaps(), vertlocations(), vertoccurrence(), vertoccurrencecount(), vertproviders(), verttaxa() are now defunct. You can call these functions, but they print an error message, saying they are defunct.
  • Gained new functions bigsearch(), searchbyterm(), spatialsearch(), and vertsummary().
  • Gained new author: Chris Ray

MINOR IMPROVEMENTS

  • RJSONIO replaced with jsonlite
  • Changed from CC0 to MIT license

rvertnet 0.0-5

NEW FEATURES

  • released to CRAN

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("rvertnet")

0.6.2 by Scott Chamberlain, 4 months ago


https://github.com/ropensci/rvertnet


Report a bug at https://github.com/ropensci/rvertnet/issues


Browse source code at https://github.com/cran/rvertnet


Authors: Scott Chamberlain [aut, cre], Chris Ray [aut], Vijay Barve [aut]


Documentation:   PDF Manual  


Task views:


MIT + file LICENSE license


Imports jsonlite, crul, dplyr, ggplot2, maps

Suggests roxygen2, testthat, knitr


Imported by spocc.


See at CRAN