wcvp_match_fuzzy: Fuzzy (approximate) matching to the WCVP.

View source: R/wcvp_match_fuzzy.R

wcvp_match_fuzzyR Documentation

Fuzzy (approximate) matching to the WCVP.

Description

Fuzzy matching to names in the WCVP using phonetic matching and edit distance. The WCVP can be loaded for matching from rWCVPdata::wcvp_names.

Usage

wcvp_match_fuzzy(names_df, wcvp_names, name_col, progress_bar = TRUE)

phonetic_match(names_df, wcvp_names, name_col)

edit_match(names_df, wcvp_names, name_col)

Arguments

names_df

Data frame of names for matching.

wcvp_names

Data frame of taxonomic names from WCVP version 7 or later. If NULL (the default), names will be loaded from rWCVPdata::wcvp_names.

name_col

Character. The column in names_df that has the taxon name for matching.

progress_bar

Logical. Show progress bar when matching? Defaults to TRUE; should be changed to FALSE if used in a markdown report.

Details

The wcvp_match_fuzzy function uses phonetic matching first and then finds the closest match based on edit distance for any remaining names.

Phonetic matching uses phonics::metaphone encoding with a maximum code length of 20.

Edit distance matching finds the closest match based on Levenshtein similarity, calculated by RecordLinkage::levenshteinSim.

Value

Match results from WCVP bound to the original data from names_df.

See Also

Other name matching functions: wcvp_match_exact(), wcvp_match_names()

Examples

 # this example requires 'rWCVPdata'
if(requireNamespace("rWCVPdata")){
wcvp_names <- rWCVPdata::wcvp_names
wcvp_match_fuzzy(redlist_example, wcvp_names, "scientificName")
}


 # this example requires 'rWCVPdata'
if(requireNamespace("rWCVPdata")){
wcvp_names <- rWCVPdata::wcvp_names
phonetic_match(redlist_example, wcvp_names, "scientificName")
}


 # this example requires 'rWCVPdata'
if(requireNamespace("rWCVPdata")){
wcvp_names <- rWCVPdata::wcvp_names
edit_match(redlist_example, wcvp_names, "scientificName")
}



rWCVP documentation built on Feb. 16, 2023, 8:30 p.m.