This rnsii package programatically download Chinese biodiversity data from the National Specimen Information Infrastructure http://www.nsii.org.cn .

Installation

Current beta / GitHub release:

Installation using R package devtools:

if (!requireNamespace(c("devtools","tibble"), quietly = TRUE))
  install.packages("devtools","tibble")
    
devtools::install_github("Otoliths/rnsii")
## Downloading GitHub repo Otoliths/rnsii@HEAD
## 
##   
   checking for file ‘/private/var/folders/1x/5mjvgdgx0m754gnfv6_dyxqm0000gn/T/RtmpxF4fQH/remotesd87b1fdc7e19/Otoliths-rnsii-0c06217/DESCRIPTION’ ...
  
✓  checking for file ‘/private/var/folders/1x/5mjvgdgx0m754gnfv6_dyxqm0000gn/T/RtmpxF4fQH/remotesd87b1fdc7e19/Otoliths-rnsii-0c06217/DESCRIPTION’
## 
  
─  preparing ‘rnsii’:
## 
  
   checking DESCRIPTION meta-information ...
  
✓  checking DESCRIPTION meta-information
## 
  
─  installing the package to process help pages
## 
  
─  saving partial Rd database (1.5s)
## 
  
─  checking for LF line-endings in source and make files and shell scripts
## 
  
─  checking for empty or unneeded directories
## 
  
─  building ‘rnsii_0.2.0.tar.gz’
## 
  
   
## 
## Installing package into '/private/var/folders/1x/5mjvgdgx0m754gnfv6_dyxqm0000gn/T/Rtmpu9KCIz/temp_libpathd8025f44ce93'
## (as 'lib' is unspecified)

Example

Load the rnsii package
library("rnsii")
Take “Artemisia argyi”
Download specimen data from the NSII
result1 <- get_nsii(query = "Artemisia argyi",offset = 0)
## Download  date: 2021-03-25
## No encoding supplied: defaulting to UTF-8.
## Query successfully: Artemisia argyi(1796)
str(result1)
## List of 5
##  $ from  : chr "国家植物标本资源库"
##  $ total : int 1796
##  $ offset: int 0
##  $ limit : int 30
##  $ data  :'data.frame':  30 obs. of  13 variables:
##   ..$ collectionID   : chr [1:30] "bca470dc" "bca47178" "bca47214" "bca472b0" ...
##   ..$ institutionCode: chr [1:30] "WUK" "WUK" "WUK" "WUK" ...
##   ..$ collectionCode : chr [1:30] "0357558" "0371743" "0365274" "0356022" ...
##   ..$ canonicalName  : chr [1:30] "Artemisia argyi" "Artemisia argyi" "Artemisia argyi" "Artemisia argyi" ...
##   ..$ formattedName  : chr [1:30] "<em>Artemisia argyi</em>  <em></em>  <em></em>" "<em>Artemisia argyi</em>  <em></em>  <em></em>" "<em>Artemisia argyi</em>  <em></em>  <em></em>" "<em>Artemisia argyi</em>  <em></em>  <em></em>" ...
##   ..$ chineseName    : chr [1:30] "艾" "艾" "艾" "艾" ...
##   ..$ recordNumber   : chr [1:30] "11193" "10505" "18245" "8733" ...
##   ..$ year           : chr [1:30] "1959" "1959" "1978" "1959" ...
##   ..$ recordedBy     : chr [1:30] "李培元" "张志英" "张志英" "李培元" ...
##   ..$ country        : chr [1:30] "中国" "中国" "中国" "中国" ...
##   ..$ stateProvince  : chr [1:30] "湖北省" "甘肃省" "陕西省" "陕西省" ...
##   ..$ withPhoto      : chr [1:30] "0" "0" "0" "0" ...
##   ..$ isType         : chr [1:30] "0" "0" "0" "0" ...
tibble::tibble(result1$data)
## # A tibble: 30 x 13
##    collectionID institutionCode collectionCode canonicalName  formattedName     
##    <chr>        <chr>           <chr>          <chr>          <chr>             
##  1 bca470dc     WUK             0357558        Artemisia arg… <em>Artemisia arg…
##  2 bca47178     WUK             0371743        Artemisia arg… <em>Artemisia arg…
##  3 bca47214     WUK             0365274        Artemisia arg… <em>Artemisia arg…
##  4 bca472b0     WUK             0356022        Artemisia arg… <em>Artemisia arg…
##  5 bca4734b     WUK             0405413        Artemisia arg… <em>Artemisia arg…
##  6 bca473e5     WUK             0354634        Artemisia arg… <em>Artemisia arg…
##  7 bdaf9f8f     WUK             0374515        Artemisia arg… <em>Artemisia arg…
##  8 bdafa02b     WUK             0360427        Artemisia arg… <em>Artemisia arg…
##  9 bdafa0c7     WUK             0288094        Artemisia arg… <em>Artemisia arg…
## 10 bdafa164     WUK             0282248        Artemisia arg… <em>Artemisia arg…
## # … with 20 more rows, and 8 more variables: chineseName <chr>,
## #   recordNumber <chr>, year <chr>, recordedBy <chr>, country <chr>,
## #   stateProvince <chr>, withPhoto <chr>, isType <chr>
Download occurrence data from the NSII
result2 <- get_occ(query = "Artemisia argyi")
## Download  date: 2021-03-25
## Query successfully: Artemisia argyi
## Include latitude and longitude: Artemisia argyi
str(result2)
## List of 10
##  $ Title      : chr "Artemisia argyi"
##  $ Description: chr "多年生草本或略成半灌木状,植株有浓烈香气。主根明显,略粗长,直径达1.5厘米,侧根多;常有横卧地下根状茎及营养枝。"| __truncated__
##  $ QueryName  : chr "Artemisia argyi"
##  $ LatinName  : chr "Artemisia argyi"
##  $ CommonName : chr "艾"
##  $ Images     :'data.frame': 1 obs. of  5 variables:
##   ..$ title      : chr "Artemisia argyi"
##   ..$ description: chr ""
##   ..$ type       : chr "image"
##   ..$ source     : chr "http://www.nsii.org.cn/eol/eolmedia/13256627.jpg"
##   ..$ url        : chr "http://www.nsii.org.cn"
##  $ Specimens  :'data.frame': 286 obs. of  9 variables:
##   ..$ barcode     : chr [1:286] "0021954" "0021953" "0021952" "0000681" ...
##   ..$ sname       : chr [1:286] "Artemisia argyi" "Artemisia argyi" "Artemisia argyi" "Artemisia argyi" ...
##   ..$ commonName  : chr [1:286] "艾" "艾" "艾" "艾" ...
##   ..$ latitude    : num [1:286] 29.8 31.6 30.2 31.3 31.3 31.3 33.8 34.1 37.4 37.4 ...
##   ..$ longitude   : num [1:286] 110 111 109 109 109 ...
##   ..$ recordedby  : chr [1:286] "李洪钧" "鄂神农架植考队" "黄仁煌" "方明渊" ...
##   ..$ recordnumber: chr [1:286] "5984" "21740" "3389" "23960" ...
##   ..$ locality    : chr [1:286] "中国湖北鹤峰县" "中国湖北神农架林区" "中国湖北利川市" "中国重庆奉节县" ...
##   ..$ year        : chr [1:286] "1958" "1976" "1975" "1958" ...
##  $ StatusCode : int 0
##  $ Status     : chr "ok"
##  $ Message    : chr ""

How to cite this package

citation("rnsii")
## 
## To cite package 'rnsii' in publications use:
## 
##   Liuyong Ding (2021). rnsii: Interface to the National Specimen
##   Information Infrastructure. R package version 0.2.0.
## 
## A BibTeX entry for LaTeX users is
## 
##   @Manual{,
##     title = {rnsii: Interface to the National Specimen Information Infrastructure},
##     author = {Liuyong Ding},
##     year = {2021},
##     note = {R package version 0.2.0},
##   }

Contribution

Contributions to this package are welcome. The preferred method of contribution is through a GitHub pull request. Feel also free to contact us by creating an issue.