Week 2 practice

Introducing distance and similarity

In Week 2 Workshop we had a go at merging datasets using fuzzy matching, from Chunk 43 onward.

We used the Levenshtein distance to calculate the distance between some strings, and set a maximum distance on which to match the column data in each of the two datasets we would like to merge.

Lets have a look at how the Levenshtein (lv) distance works.

We need the library stringdist which I have installed for you.

We can define our strings:

Calculate the Levenshtein distance

Print the result

Try changing the strings!