wcvp_match_names {rWCVP}R Documentation

Match names to the WCVP.

Description

Match names to WCVP, first using exact matching and then using fuzzy matching on any remaining unmatched names.

Usage

wcvp_match_names(
  names_df,
  wcvp_names = NULL,
  name_col = NULL,
  id_col = NULL,
  author_col = NULL,
  join_cols = NULL,
  fuzzy = TRUE,
  progress_bar = TRUE
)

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.

id_col

Character. A column in names_df with a unique ID for each name. Will be created from the row number if not provided.

author_col

the column in names_df that has the name authority, to aid matching. Set to NULL to match with no author string.

join_cols

Character. A vector of name parts to make the taxon name, if name_col is not provided.

fuzzy

Logical; whether or not fuzzy matching should be used for names that could not be matched exactly.

progress_bar

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

Details

By default, exact matching uses only the taxon name (supplied by name_col) unless a column specifying the author string is provided (as author_col).

Columns setting out name parts can be supplied as join_cols in place of a taxon name, but must be supplied in the order you want them joined (e.g. c("genus", "species", "infra_rank", "infra")).

Fuzzy matching uses a combination of phonetic and edit distance matching, and can optionally be turned off using fuzzy=FALSE.

The WCVP can be loaded for matching from rWCVPdata::wcvp_names.

See here for an example workflow.

Value

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

See Also

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

Examples

 # these examples require 'rWCVPdata'
if(requireNamespace("rWCVPdata")){
wcvp_names <- rWCVPdata::wcvp_names

# without author
wcvp_match_names(redlist_example, wcvp_names,
  name_col = "scientificName",
  id_col = "assessmentId"
)

# with author
wcvp_match_names(redlist_example, wcvp_names,
  name_col = "scientificName",
  id_col = "assessmentId", author_col = "authority"
)
}



[Package rWCVP version 1.2.4 Index]