Skip to contents

This function checks the validity of species names in a data frame using the check_names function from the specleanr package, allowing for flexible matching accuracy and synonym lookup. It extends check_names by enabling loops through different matching accuracy levels if required. Additionally, if manual = TRUE, the function launches a Shiny app to allow for manual editing of the names after the automatic checking process is complete.

Usage

check_species_name(
  data,
  col_species_name,
  verbose = FALSE,
  target_accuracy = 90,
  accuracy_decrement = NULL,
  synonym = FALSE,
  manual = FALSE
)

Arguments

data

A data frame containing species names.

col_species_name

A character string specifying the column in data with species names.

verbose

Logical, if TRUE, additional information will be printed during execution.

target_accuracy

Numeric, the starting accuracy (in percentage) for species name matching.

accuracy_decrement

Numeric, optional. If provided, the function will loop through decreasing accuracy levels, decrementing by this value.

synonym

Logical, if TRUE, synonym names will be considered when checking species names.

manual

Logical, if TRUE, after the name-checking process, the function will call a Shiny app for manual editing of the results.

Value

If accuracy_decrement is NULL, the function returns a single data frame with checked species names. If accuracy_decrement is provided, it returns a list of data frames for each accuracy level. If manual = TRUE, the function will return a manually updated data frame after the Shiny app interaction.

Examples

if (FALSE) { # \dontrun{
  library(specleanr)
  data <- data.frame(species = c("Salmo salar", "Oncorhynchus mykiss"))
  result <- check_species_name(data, col_species_name = "species", target_accuracy = 95)
} # }