The given function uses \"stringdist\" package in R and tells the minimum changes needed to change one string to another. I wish to find out how much similar is one string to an
Something like this might work:
d <- data.frame(original = c("abcd", "defg", "hij"), new = c("abce", "zxyv", "hijk"))
d$dist <- stringdist(d$original, d$new, method = "lv")
d$similarity <- 1 - d$dist / nchar(as.character(d$original))
#### Returns:
#### original new dist similarity
#### 1 abcd abce 1 0.7500000
#### 2 defg zxyv 4 0.0000000
#### 3 hij hijk 1 0.6666667