knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.align = "center", fig.width = 8, fig.height = 5 ) library(dplyr) library(ggplot2) library(redlist)
In this vignette, I will examine assessments specific to Benin. I will walk through three types of visualizations:
Refer to this vignette to learn more about how to access the data.
# Load the package library(redlist) # Get all data on Benin benin_rl <- rl_countries(code = "BJ", page = NA)
benin_rl <- readRDS("benin_full_data.rds")
# Basic overview glimpse(benin_rl)
The dataset includes all species assessed in Benin across various taxonomic groups — including plants, animals, fungi, and other organisms.
Understanding the volume of assessments over time gives insight into conservation attention and effort.
benin_rl %>% count(assessments_year_published) %>% ggplot(aes(x = assessments_year_published, y = n)) + geom_line(color = "steelblue") + geom_point(color = "darkblue") + labs( title = "Number of assessments per year in Benin", x = "Year", y = "Number of assessments" ) + theme_minimal()
Most species in Benin fall under Least Concern (LC), but some are classified as threatened. This chart highlights the proportion of assessments by category.
benin_rl %>% filter(!is.na(assessments_red_list_category_code)) %>% count(assessments_red_list_category_code) %>% mutate(prop = n / sum(n)) %>% ggplot(aes(x = reorder(assessments_red_list_category_code, -prop), y = prop)) + geom_col(fill = "salmon") + scale_y_continuous(labels = scales::percent_format()) + labs( title = "Proportion of red list categories in Benin", x = "Red List Category", y = "Proportion" ) + theme_minimal()
Focusing on Critically Endangered (CR), Endangered (EN), and Vulnerable (VU) species helps track biodiversity risk.
benin_rl %>% filter(assessments_red_list_category_code %in% c("CR", "EN", "VU")) %>% count(assessments_year_published, assessments_red_list_category_code) %>% ggplot(aes(x = assessments_year_published, y = n, color = assessments_red_list_category_code)) + geom_line() + geom_point() + labs( title = "Trends of Threatened Categories (CR, EN, VU) Over Time", x = "Year", y = "Number of Assessments", color = "Category" ) + theme_minimal()
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.