Replace string within a variable in R using fuzzy matching
===

I have data with 3 relevant variables: The first is an activity (x1), the second is the respondents rating of that activity (x2), and the third is the proper name of the activity in x1 (x3).  The x1 variables are respondent written, and very close matches to the reference variable of the activity x3, but all a little bit different.  I would like to match and replace all x1's with the reference x3 - I was thinking of using a loop referring to each reference activity x3 and replacing the x1 respondent written activity using a program like agrep.  However, agrep seems only to tell me how many matches there are.  How can I replace the x1 variables with the "correct" string title in x3?