match_fuzzy: Fuzzy matcher

Description Usage Arguments Examples

View source: R/match_fuzzy.R

Description

Fuzzy matcher

Usage

1
2
3
4
5
6
7
match_fuzzy(x, ref = NULL, against = NULL, ...)

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

## S3 method for class '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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Not run: 
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)

## End(Not run)

sckott/splister documentation built on May 26, 2017, 3:49 a.m.