I would like to use R to compare a lot of integer lists, using edit-distance.
Ex: list1[231, 3883, 21099, 12, 2]
and list2[433, 3883, 12, 919, 2]
I'd like to get just the distance between those two list. Ex. with the lists above, the distance would equal 3
. Because to make list2
like list1
, you would substitute 231
for 433
, then add 21099
after 3883
, then delete 919
.
I would like to find how many adds and removes I would need to make list1 look like list2. I know that R has the built in function: adist()
. That however, only seems to work for comparing strings (not even lists of strings). Google keeps pushing me to adist()
and dist()
neither of which are going to solve this problem. I'd rather not reinvent the wheel, so is there a function already in existence? I've attempted to rewrite adist()
as found here: https://searchcode.com/codesearch/view/13555814/
but its too complex for my current R ability.