title: Insert an R data.frame into a mysql table in the mysql REPLACE fashion
body: <p>(Sorry if this is very basic, I'm just not able to figure out)</p>
  
  <p>I have a table t sitting in a mysql db, which looks like this: (Name is the primary key)</p>
  
  <p><strong>Current Table in DB</strong></p>
  
  <pre><code>Name   Balance
   Bob      100
   Ted      150
   Carl     130
  </code></pre>
  
  <p>I also have a data.frame in R reflecting changed balances</p>
  
  <p><strong>data.frame in R</strong></p>
  
  <pre><code>Name   Balance
   Bob      90
   Ted      170
   Bill     50
  </code></pre>
  
  <p>I want to perform the equivalent of a mysql <a href="http://dev.mysql.com/doc/refman/5.6/en/replace.html" rel="noreferrer">replace</a>, so that my table gets updated to reflect the new balances</p>
  
  <p><strong>Desired Table in DB</strong></p>
  
  <pre><code>Name   Balance
   Bob      90
   Ted      170
   Carl     130
   Bill     50
  </code></pre>
  
  <p>I'm currently using the RMySQL package- I tried doing this with dbWriteTable, but am not able to get this to work.</p>
  
  <p><strong>Eg1</strong> ("Insert")</p>
  
  <pre><code>dbWriteTable(dbConnection, 'tableName', df, row.names=F, append=T)
  </code></pre>
  
  <p>Produces</p>
  
  <pre><code>Name   Balance
   Bob      100
   Ted      150
   Carl     130
   Bill     50
  </code></pre>
  
  <p><strong>Eg2</strong> ("Overwrite")</p>
  
  <pre><code>dbWriteTable(dbConnection, 'tableName', df, row.names=F, append=F, overwrite=T)
  </code></pre>
  
  <p>Produces</p>
  
  <pre><code>Name   Balance
   Bob      90
   Ted      170
   Bill     50
  </code></pre>
  
  <p>How do I do a replace?</p>