## Calculates Levenshtein distance:
Ldist <- function(pattern, strings){
minD <- function(string, pattern){
for (i in seq(0, 1, .001)) {
x <- agrep(pattern, string, max.distance = i)
if (!identical(x, integer(0))) {
m <- i
break
}
}
m
}
unlist(lapply(strings, minD, pattern = pattern))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.