AlgaeBase is a comprehensive database containing information on a wide variety of algae species, including terrestrial, marine, and freshwater organisms, with an emphasis on marine botany. AlgaeBase is continually updated and funded by various phycological societies, with contributions from researchers and institutions worldwide. It can be accessed via a web interface or through the API, as demonstrated in this tutorial using SHARK4R
. Please note that the authors of SHARK4R
are not affiliated with AlgaeBase.
You can install the package from GitHub using the devtools
package:
# install.packages("devtools") devtools::install_github("sharksmhi/SHARK4R", dependencies = TRUE)
Load the SHARK4R
and tibble
libraries:
library(SHARK4R) library(tibble)
suppressPackageStartupMessages({ library(SHARK4R) library(tibble) })
AlgaeBase requires a subscription key to access its API. To obtain your own key, please visit the API documentation. In the example below, the key is retrieved from an environment variable.
# Retrieve the API key algaebase_key <- Sys.getenv("ALGAEBASE_KEY")
Taxonomic records can be retrieved for individual genera names using the get_algaebase_genus
function.
# Match a genus name with AlgaeBase API genus_records <- get_algaebase_genus(genus = "Gymnodinium", apikey = algaebase_key) # Print the result print(genus_records)
Taxonomic records can be retrieved for individual species names using the get_algaebase_species
function.
# Match a species with AlgaeBase API species_records <- get_algaebase_species(genus = "Tripos", species = "muelleri", apikey = algaebase_key) # Print the result print(species_records)
Multiple names can be matched with the match_algaebase
function. The scientific names need to be parsed into genus
and species
names before being passed to the API, which can be achieved by the parse_scientific_names
function.
# Retrieve all phytoplankton data from April 2015 shark_data <- get_shark_data(fromYear = 2015, toYear = 2015, months = 4, dataTypes = c("Phytoplankton"), verbose = FALSE) # Randomly select 10 rows from the shark_data dataframe random_rows <- shark_data[sample(nrow(shark_data), 10), ] # Parse scientific names into genus and species names parsed_taxa <- parse_scientific_names(random_rows$scientific_name) # Print the parsed data print(parsed_taxa) # Match the taxa with AlgaeBase algaebase_match <- match_algaebase(genus = parsed_taxa$genus, species = parsed_taxa$species, apikey = algaebase_key, verbose = FALSE) # Print the result tibble(algaebase_match)
# Print citation citation("SHARK4R")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.