Skip to contents

This function attempts to retrieve WoRMS records using the provided taxa names. It retries the operation if an error occurs, up to a specified number of attempts.

Usage

ifcb_match_taxa_names(
  taxa_names,
  fuzzy = TRUE,
  best_match_only = TRUE,
  max_retries = 3,
  sleep_time = 10,
  marine_only = FALSE,
  return_list = FALSE,
  verbose = TRUE
)

Arguments

taxa_names

A character vector of taxa names to retrieve records for.

fuzzy

A logical value indicating whether to search using a fuzzy search pattern. Default is TRUE.

best_match_only

A logical value indicating whether to automatically select the first match and return a single match. Default is TRUE.

max_retries

An integer specifying the maximum number of attempts to retrieve records.

sleep_time

A numeric value indicating the number of seconds to wait between retry attempts.

marine_only

Logical. If TRUE, restricts the search to marine taxa only. Default is FALSE.

return_list

A logical value indicating whether to to return the output as a list. Default is FALSE, where the result is returned as a dataframe.

verbose

A logical indicating whether to print progress messages. Default is TRUE.

Value

A data frame (or list if return_list is TRUE) of WoRMS records or NULL if the retrieval fails after the maximum number of attempts.

Examples

if (FALSE) { # \dontrun{
# Example: Retrieve WoRMS records for a list of taxa names
taxa <- c("Calanus finmarchicus", "Thalassiosira pseudonana", "Phaeodactylum tricornutum")
records <- ifcb_match_taxa_names(taxa_names = taxa,
                                 max_retries = 3,
                                 sleep_time = 5,
                                 marine_only = TRUE,
                                 verbose = TRUE)

print(records)
} # }