Chapter 6 rvertnet

6.1 What is rvertnet?

rvertnet is an R package for interacting with VertNet.org.

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

6.2 Basic example

Load rvertnet

library(rvertnet)

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

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

metadata

res$meta
#> NULL

data. A tibble is given back:

res$data
#> NULL

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)
res$data
#> # A tibble: 20 x 89
#>    kingdom recordedby higherclassific… stateprovince basisofrecord month
#>    <chr>   <chr>      <chr>            <chr>         <chr>         <chr>
#>  1 Animal… STENHOUSE… | Chordata |  |… New South Wa… PreservedSpe… 6    
#>  2 Animal… Dewitt, L  | Chordata |  |… New South Wa… PreservedSpe… 3    
#>  3 Animal… NSW State… | Chordata |  |… New South Wa… PreservedSpe… 9    
#>  4 Animal… A. Seale   <NA>             Guam          PreservedSpe… 7    
#>  5 Animal… <NA>       Animalia | Chor… <NA>          PreservedSpe… 11   
#>  6 Animal… A. C. Alc… Animalia; Chord… <NA>          PreservedSpe… 3    
#>  7 Animal… A. C. Alc… Animalia; Chord… <NA>          PreservedSpe… 3    
#>  8 Animal… R. H. Beck Animalia; Chord… California    PreservedSpe… 7    
#>  9 Animal… R. H. Beck Animalia; Chord… California    PreservedSpe… 7    
#> 10 Animal… R. H. Beck Animalia; Chord… California    PreservedSpe… 7    
#> 11 Animal… R. H. Beck Animalia; Chord… California    PreservedSpe… 7    
#> 12 Animal… R. H. Beck Animalia; Chord… California    PreservedSpe… 6    
#> 13 Animal… R. H. Beck Animalia; Chord… California    PreservedSpe… 4    
#> 14 Animal… A. Fish    Animalia; Chord… California    PreservedSpe… 7    
#> 15 Animal… S. Cutler  Animalia; Chord… California    PreservedSpe… 6    
#> 16 Animal… S. Cutler  Animalia; Chord… California    PreservedSpe… 8    
#> 17 Animal… S. Cutler  Animalia; Chord… California    PreservedSpe… 9    
#> 18 Animal… Judith Co… Animalia; Chord… California    PreservedSpe… 8    
#> 19 Animal… <NA>       Animalia; Chord… Illinois      PreservedSpe… 1    
#> 20 Animal… Robin, D.  Procellariiform… Alaska        PreservedSpe… 7    
#> # … with 83 more variables: decimallongitude <chr>, phylum <chr>,
#> #   references <chr>, year <chr>, startdayofyear <chr>, taxonrank <chr>,
#> #   specificepithet <chr>, bibliographiccitation <chr>, family <chr>,
#> #   countrycode <chr>, geodeticdatum <chr>,
#> #   coordinateuncertaintyinmeters <chr>, highergeography <chr>,
#> #   accessrights <chr>, verbatimlocality <chr>, verbatimeventdate <chr>,
#> #   day <chr>, eventid <chr>, collectioncode <chr>, occurrencestatus <chr>,
#> #   locationremarks <chr>, coordinateprecision <chr>, institutioncode <chr>,
#> #   scientificname <chr>, class <chr>, vernacularname <chr>,
#> #   decimallatitude <chr>, occurrenceid <chr>, language <chr>, license <chr>,
#> #   country <chr>, georeferenceverificationstatus <chr>, modified <chr>,
#> #   eventdate <chr>, identifiedby <chr>, nomenclaturalcode <chr>,
#> #   continent <chr>, genus <chr>, order <chr>, catalognumber <chr>,
#> #   enddayofyear <chr>, dateidentified <chr>, individualcount <chr>,
#> #   georeferenceprotocol <chr>, georeferencedby <chr>, preparations <chr>,
#> #   typestatus <chr>, georeferenceddate <chr>, footprintwkt <chr>,
#> #   locality <chr>, disposition <chr>, georeferenceremarks <chr>,
#> #   identificationremarks <chr>, othercatalognumbers <chr>, fieldnumber <chr>,
#> #   waterbody <chr>, recordnumber <chr>, infraspecificepithet <chr>,
#> #   islandgroup <chr>, georeferencesources <chr>, verbatimlongitude <chr>,
#> #   sex <chr>, island <chr>, verbatimlatitude <chr>, lifestage <chr>,
#> #   scientificnameauthorship <chr>, county <chr>, dynamicproperties <chr>,
#> #   occurrenceremarks <chr>, verbatimcoordinatesystem <chr>,
#> #   identificationverificationstatus <chr>, identificationqualifier <chr>,
#> #   institutionid <chr>, eventremarks <chr>, organismid <chr>, eventtime <chr>,
#> #   verbatimcoordinates <chr>, informationwithheld <chr>, collectionid <chr>,
#> #   previousidentifications <chr>, locationaccordingto <chr>,
#> #   associatedmedia <chr>, datasetname <chr>

6.2.1 downstream data manipulation

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: 20 x 2
#>    scientificname                  count
#>    <chr>                           <int>
#>  1 Ochotona princeps                 450
#>  2 Ochotona pallasi                  129
#>  3 Ochotona princeps saxatilis       103
#>  4 Ochotona hyperborea                30
#>  5 Ochotona dauurica                  21
#>  6 Ochotona collaris                  15
#>  7 Ochotona princeps figginsi         14
#>  8 Ochotona princeps taylori           8
#>  9 Ochotona princeps schisticeps       6
#> 10 Ochotona alpina                     4
#> 11 Ochotona princeps muiri             4
#> 12 Ochotona hyperborea mantchurica     3
#> 13 Ochotona princeps incana            3
#> 14 Ochotona princeps princeps          3
#> 15 Ochotona princeps murri             2
#> 16 Ochotona princeps brunnescens       1
#> 17 Ochotona princeps jewetti           1
#> 18 Ochotona princeps tutelata          1
#> 19 Ochotona princeps uinta             1
#> 20 Ochotona princeps ventorum          1