title: Replace column values by grep in R
body: <p>I am dealing with big data and I would like to replace column values by grep.</p>
  
  <p>Here is a simple example: </p>
  
  <pre><code>data=data.frame(state=c("AlAbama","Alaaska","Arizoona"),
                      gender=c("male","female","female"))
  datalist=data.frame(state=c("Alabama","Alaska","Arizona"))
  </code></pre>
  
  <p>In the data called "data", I have the states names written in a wrong way and I would like to replace them by the write names in datalist. 
  So I would like to replace column values in "data" with column values in "datalist"  using grep.</p>
  
  <p>I have tried this:</p>
  
  <pre><code>data[grep(data[,"state"],datalist[,"state"])]
  </code></pre>
  
  <p>And this:</p>
  
  <pre><code>for (u in datalist$state){
  data[grep(u,datalist$state)]
  }
  </code></pre>
  
  <p>But it doesn't work.</p>
  
  <p>Do you have any ideas how to solve this problem?</p>
  
  <p>Sincerely yours,
  Mily</p>