Search for a word or phrase in a second vector that matches the another word in the first vector.

fuzzy_search(x = NULL, y = NULL)

Arguments

x

The vector with strings to be searched for in the second vector

y

The vector with usually the correct strings to be found

Value

A vector of best matches from y based on the x input vector.

Details

This is a helpful function to correct city names according to IBGE names, when the list is to long to correct by hand.

Examples

wrong_names<-c("Mogi das Cruses","Sao Paulo","CANTA GALLO") correct_names<-c("Canta Galo","Mogi das Cruzes","São Paulo") fuzzy_search(x=wrong_names,y=correct_names)
#> [1] "Mogi das Cruzes" "São Paulo" "Canta Galo"