Closed davharris closed 8 years ago
This code (based on iucn_summary
) pulls out the numeric ID.
spec <- tolower(sciname)
spec <- gsub(" ", "-", spec)
url <- paste("http://api.iucnredlist.org/go/", spec, sep = "")
e <- try(h <- readLines(url), silent = silent)
id_plus = grep("http://www.iucnredlist.org/apps/redlist/details/", e, value = TRUE)
gsub(".*/", "", id_plus)
nice work answering your own question.
Do you thin it warrants a new fxn in taxize?
That's what I wasn't sure about. Whichever approach you prefer.
Sure, I think a iucn_id()
function is warranted.
See also issue https://github.com/ropensci/taxize/issues/174.
Do any existing functions return IUCN's numeric IDs (e.g. 22679935 for the Canada Goose)? I'm finding that I need them for the
birdlife_*
functions in the traits package.If there isn't currently a way to get them, what would the best option be? I could create a new function (either here or in the traits package), or if you'd prefer, maybe I could add it to an IUCN-related function here.
Thanks!