I need some help to understand the arguments of these functions. I took the example from the help.
## To see the transformation counts for the Levenshtein distance:
drop(attr(adist("kitten", "sitting", counts = TRUE), "counts"))
# ins del sub
# 1 0 2
ins, stands for insertions; del for deletions; and sub for substitutions.
## To see the transformation sequences:
attr(adist(c("kitten", "sitting"), counts = TRUE), "trafos")
# [,1] [,2]
# [1,] "MMMMMM" "SMMMSMI"
# [2,] "SMMMSMD" "MMMMMMM"
From this is easy to see that while comparing the string one visa vie the string two, it finds SMMMSMI
; 2 substitutions and 1 insertion, in total the distance should be three.
adist("kitten", "sitting", costs = list(ins=1, del=0, sub=1), partial = F)
# [,1]
# [1,] 3
This is what I don't get, why when I set the cost of insertions equal to zero, the outcome is zero in the total distance. I would expect to be 2, because of the number of substitutions.
adist("kitten", "sitting", costs = list(ins=0, del=0, sub=1), partial = F)
# [,1]
# [1,] 0
Thanks a lot.