title: Replace misspelled values with agrep
body: <p>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):</p>
  
  <blockquote>
    <p>rest2012$CONAME &lt;- agrep("MC DONALD'S", rest2012$CONAME, ignore.case = FALSE, value = FALSE, max.distance = 3)</p>
  </blockquote>
  
  <p>I'm getting the following error message:
  Error in <code>$&lt;-.data.frame</code>(<code>*tmp*</code>, "CONAME", value = c(35L, 40L, 48L,  : 
    replacement has 3074 rows, data has 67424</p>
  
  <p>Is there another way I can replace the misspelled names or am I simply using the agrep function wrong?</p>