Fuzzy matcher

match_fuzzy(x, ref = NULL, against = NULL, ...)

# S3 method for character
match_fuzzy(x, ref = NULL, against = NULL, ...)

# S3 method for splist
match_fuzzy(x, ref = NULL, against = NULL, ...)

Arguments

x

Input species list, a character vector

ref

Reference taxon data.frame, or file path

against

(character) What column to match against in data.frame. Ignored if a vector given

...

Further args passed on to grep

Examples

if (FALSE) { x <- c("Salmo eperlanus Linnaeus, 1758", 'Oncorhynchus clarkii', 'Salmo', 'Oncorhynchus clarkii', 'Salvelinus fontinalis', 'Salvelinus confluentus') y <- system.file("examples", "worms_salmo.csv", package = "splister") dat <- unique(read.csv(y, stringsAsFactors = FALSE)) # get exact matches res <- match_exact(x, ref = dat, against = "scientificName") # then move on to do fuzzy matching match_fuzzy(res) # pipe, if you like match_exact(x, ref = dat, against = "scientificName") %>% match_fuzzy # read from file x <- system.file("examples", "iucn_dat.csv", package = "splister") x <- read.csv(x, stringsAsFactors = FALSE)[,-1] y <- system.file("examples", "worms_sample.csv", package = "splister") spp <- x$sciname[1:5000L] (res <- match_exact(spp, ref = y, against = "scientificName")) res2 <- match_fuzzy(res) }