Skip to contents

[Experimental]

This function processes a list of species names to match their genera with a database. It first attempts to match genera exactly and then applies fuzzy matching for unmatched cases. The function provides detailed messages about the matching process, including the number of exact matches, fuzzy matches, and unmatched inputs.

Usage

filter_iucn_genus(splist)

Arguments

splist

A character vector containing the species names to be processed. Each name should include the genus and species (e.g., "Panthera uncia").

Value

A tibble with the following columns:

  • submitted_name: The original species name submitted.

  • or_genus_name: The genus extracted from the submitted name.

  • matched_genus: The genus name that was matched (either exactly or via fuzzy matching).

  • direct_match_genus: A logical value indicating whether the genus was matched exactly.

  • fuzzy_match_genus: A logical value indicating whether the genus was matched using fuzzy matching.

If any genera remain unmatched, they will have NA in the matched_genus column, and both direct_match_genus and fuzzy_match_genus will be FALSE or NA.

Details

The function follows these steps:

  1. Preprocess the species list using the helper function format_df().

  2. Perform exact genus matching using genus_exact_match().

  3. If there are unmatched genera, apply fuzzy matching using genus_fuzzy_match().

  4. Combine results from both exact and fuzzy matching into a single tibble.

  5. Identify unmatched genera and provide a summary of matching statistics via informative messages.

Examples

filter_iucn_genus(c("Panthera uncia", "Cedrela odorata"))
#> 
#> ── Matching names to IUCN genus list ───────────────────────────────────────────
#>  All input genera were matched successfully (2 exact, 0 fuzzy).
#> # A tibble: 2 × 6
#>      id submitted_name  or_genus_name matched_genus direct_match_genus
#>   <int> <chr>           <chr>         <chr>         <lgl>             
#> 1     1 Panthera uncia  Panthera      Panthera      TRUE              
#> 2     2 Cedrela odorata Cedrela       Cedrela       TRUE              
#> # ℹ 1 more variable: fuzzy_match_genus <lgl>