options(width=160)

First, let's load some libraries.

library(rdopa)
library(dplyr)

Basic information and statistics

DOPA provides an array of information on species and protected area (PA) occurrence within the borders (or in some cases the Exclusive Economic Zone boundary) of a given country. country_list() can be used to list all the countries available in the DOPA database:

# NOTE: currently (in version 0.1.6) DOPA server is giving a 500 internal server
# error so this doesn't work
cl <- country_list(cache = FALSE)
head(cl)

Species

There are also few convience function to retrieve species information on conuntry-level. To list species included in a particular IUCN status category within a given country, use function country_species_list(). For example, if you're interested in all (globally) threatened species (i.e. those in IUCN categories CR, EN, or VU) that occur in Finland, do the following:

threatened.fin <- country_species_list('Finland', status=c("CR", "EN", "VU"),
                                       cache = FALSE)
# Select only part of the columns (using dplyr)
select(threatened.fin, iucn_species_id, taxon, class, status, commonname)

Function country_species_count() returns the total number of species within a given country that belong to a specific status categories. For example, to get the number of threatened species in Brazil:

country_species_count('Brazil', rlstatus=c("CR", "EN", "VU"),
                      cache = FALSE)

This - and breakdown into individual categories - can of course be achieved by working with the complete country-specific species list:

threatened.bra <- country_species_list('Brazil', status=c("CR", "EN", "VU"),
                                       cache = FALSE)
# Total number
nrow(threatened.bra)
# Per category (using dplyr)
threatened.bra %>%
  group_by(status) %>%
  summarise(count = n()) 

Protected areas

Protected area (PA) statistics are available per country according to IUCN PA categories:

Within a given country, statistics for individual PAs can be retrieved using pa_country_stats(). Let's find out all the PAs within Uganda:

uganda_pa_stats <- pa_country_stats("Uganda", cache = FALSE)
nrow(uganda_pa_stats)

So Uganda has 58 individual PAs in the WDPA.



ropensci/rdopa documentation built on May 18, 2022, 6:32 p.m.