bestMismatch: Find fewest mismatches

Description Usage Arguments Value Author(s)

View source: R/leven.R

Description

Find fewest mismatches (and position if desired) between pattern and string without allowing gaps. Could be programmed better but quick enough for now.

Usage

1
2
bestMismatch(pattern, subject, pos = findAll, weights = rep(1,
  nchar(pattern)), findAll = FALSE, dummyChar = "|")

Arguments

pattern

String pattern to search for in subject

subject

Subject string to search in

pos

If TRUE return position in addition to distance

weights

Integer weights for each position of pattern

findAll

If TRUE return all best matches

dummyChar

A character that does not appear in either string (only necessary if findAll==TRUE [and could probably program better])

Value

Single value giving the least mismatch if pos=FALSE, c(minMismatches,position) if pos=TRUE, if findAll==TRUE matrix with columns minMismatches, position and rows for each occurrence

Author(s)

Scott Sherrill-Mix [email protected]


sherrillmix/levenR documentation built on May 26, 2017, 8:08 a.m.