R SP2000 批量获取中国范围内指定科级类群下的物种名录

不久前在《生物多样性》杂志上看到一个获取中国物种名录的R 包:SP2000, 基于中国物种2000节点,该数据库每年更新,获取的物种名录应该是比较新的。
原文章地址:https://www.biodiversity-science.net/CN/10.17520/biods.2020235
DOI: 10.17520/biods.2020235

# SP2000 package usage
library(SP2000)
library(purrr)
library(tidyverse)

#  define all the taxon we want to retrieve
China_carnivora <- tribble(~ family_names, "Ailuridea","Canidae","Felidae","Herpestidae","Mustelidae","Otariidae","Phocidae","Ursidae","Viverridae")
my_species2000_key <- "input your key"
set_search_key(my_species2000_key)
# retrieve the unique ID
pre_result_family <- China_carnivora %>% mutate(., SP2000_pull = map(family_names, search_family_id))

pre_result_family_result_clean <- pre_result_family %>%
  mutate(., family_id = purrr::map_chr(SP2000_pull, #   select the "SP2000" column
                                       pluck,  #  pluck function in purrr
                                       1,  # pluck the first level
                                       "data",  #  continue sort the next level data
                                       "record_id")) %>%  #  sort the data in the column "record_id"
  dplyr::select(family_names, family_id)  # select the two column

# we can use "search_taxon_id" after "search_family_id" 
pos_result_species <- 
  purrr::map(pre_result_family_result_clean$family_id, search_taxon_id, name = "familyID", mc.cores = 6) %>% 
  purrr::map_df(., pluck, 1, "data") %>%
  dplyr::select(chineseName, scientificName, taxonTree)

write.csv(pos_result_species,"pos_result_species.csv")

水平有限,如有误欢迎批评指正

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容