I have a dataset of restaurants and the variable "CONAME" contains the name of each establishment. Unfortunately, there are quite a few misspellings, and I'd like to correct them. I've tried agrep for fuzzy set matching using the following code (which I'll repeat for all major chains):
rest2012$CONAME <- agrep("MC DONALD'S", rest2012$CONAME, ignore.case = FALSE, value = FALSE, max.distance = 3)
I'm getting the following error message:
Error in $<-.data.frame
(*tmp*
, "CONAME", value = c(35L, 40L, 48L, :
replacement has 3074 rows, data has 67424
Is there another way I can replace the misspelled names or am I simply using the agrep function wrong?