Eduard Szöcs

Data in Environmental Science and Eco(toxico-)logy

IUCN Red List with R

From a question to [r-sig-eco] mailing list:

Just a small function to get the status of a species from the IUCN Red List API:

get_IUCN_status <- function(x) {
    spec <- tolower(x)
    spec <- gsub(" ", "-", spec)
    url <- paste("", spec, sep = "")
    h <- htmlParse(url)
    status <- xpathSApply(h, "//div[@id =\"red_list_category_code\"]", xmlValue)
get_IUCN_status("Panthera uncia")
## [1] "EN"

Have also a look at Kay Cichinis extended version!

Written on December 1, 2012