'NatureServe' Interface

Interface to 'NatureServe' (< http://www.natureserve.org>). Includes methods to get data, image metadata, search taxonomic names, and make maps.


cran checks Build Status Build status codecov cran version rstudio mirror downloads

natserv NatureServe R client

NatureServe is a non-profit organization that provides wildlife conservation related data to various groups including the public.

All functions in this package are prefixed with ns_ to prevent collision with other pkgs.

Three NatureServe web services are available in this package:

  • Name lookup (ns_search) lookup species Unique IDs (UID) by name. These UIDs are required for access to the more detailed services.
  • Image lookup (ns_images) search for metadata for NatureServe images, including the URL's for the image files themselves.
  • Fetch data (ns_data) on over 70,000 of the plant and animal species of the United States and Canada.

You'll need an API key to use this package. Get one by signing up at https://services.natureserve.org/developer/index.jsp

See also the taxize book for a manual on working with taxonomic data in R, including with NatureServe data.

Stable version from CRAN

install.packages("natserv")

Development version

remotes::install_github("ropensci/natserv")
library('natserv')

search

ns_search(x = "Helianthus annuus")
#> # A tibble: 1 x 4
#>   globalSpeciesUid   jurisdictionScien… commonName natureServeExplorerURI  
#>   <chr>              <chr>              <chr>      <chr>                   
#> 1 ELEMENT_GLOBAL.2.… Helianthus annuus  Common Su… http://explorer.natures

data

res <- ns_data(uid = 'ELEMENT_GLOBAL.2.100925')
names(res$ELEMENT_GLOBAL.2.100925)
#>  [1] "uid"                   "speciesCode"          
#>  [3] "natureserve_uri"       "classification"       
#>  [5] "economicAttributes"    "ecologyAndLifeHistory"
#>  [7] "license"               "references"           
#>  [9] "conservationStatus"    "managementSummary"    
#> [11] "distribution"

dig into distribution in various watersheds

res$ELEMENT_GLOBAL.2.100925$distribution$watersheds
#> # A tibble: 527 x 4
#>    type  watershedName    watershedCode speciesOccurrenceCount
#>    <chr> <chr>            <chr>         <chr>                 
#>  1 HUC-8 Housatonic       01100005      1                     
#>  2 HUC-8 Upper Hudson     02020001      3                     
#>  3 HUC-8 Middle Hudson    02020006      1                     
#>  4 HUC-8 Hudson-Wappinger 02020008      2                     
#>  5 HUC-8 Noxubee          03160108      1                     
#>  6 HUC-8 Lower Leaf       03170005      1                     
#>  7 HUC-8 Pascagoula       03170006      2                     
#>  8 HUC-8 Black            03170007      1                     
#>  9 HUC-8 Escatawpa        03170008      1                     
#> 10 HUC-8 Black            04150101      1                     
#> # … with 517 more rows

image metadata

res <- ns_images(commonName = "*eagle", resolution = 'thumbnail')
res$images[[1]][1:5]
#> $id
#> [1] "15512"
#> 
#> $scientificName
#> [1] "Haliaeetus leucocephalus"
#> 
#> $commonName
#> [1] "Bald Eagle"
#> 
#> $otherCommonName
#> [1] "bald eagle"
#> 
#> $otherCommonName
#> [1] "pygargue à tête blanche"

Meta

  • Please report any issues or bugs.
  • License: MIT
  • Get citation information for natserv in R doing citation(package = 'natserv')
  • 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.

ropensci

News

natserv 0.3.0

NEW FEATURES

  • gains a vignette: "Introduction to natserve - An R package to wrap NatureServe's database API from rOpenSci" (#6) (#16) all work done by @mairindeith - thanks!

MINOR IMPROVEMENTS

  • add vcr for tests so that http requests are cached (#18)
  • link to taxize book in readme and vignette (#15)
  • improve failure behavior. the NatureServe API returns 200 on no result found, so we have to do gymnastics to catch that scenario (#9)

BUG FIXES

  • bug in ns_data() fixed related to subnations (#10)
  • a bunch of checks added within ns_data(), ns_images(), and ns_search() to catch common bad inputs to the functions (#11)
  • fixed bug in internal function check_uid() that was throwing warnings in ns_data() when passing more than one input (#14)

natserv 0.1.4

MINOR IMPROVEMENTS

  • natserv now requires crul >= 0.2.0, which fixed URL encoding to make our work in natserv easier.

natserv 0.1.0

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("natserv")

0.3.0 by Scott Chamberlain, 2 months ago


https://github.com/ropensci/natserv


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


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


Authors: Scott Chamberlain [aut, cre]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports crul, xml2, tibble, data.table

Suggests testthat, knitr, ggplot2, maps, mapproj, vcr


Imported by taxize.


See at CRAN