(Sorry if this is very simple, I just can't understand)
I have a table t sitting in mysql db that looks like this: (The name is the primary key)
Current table in DB
Name Balance
Bob 100
Ted 150
Carl 130
I also have data.frame in R reflecting modified balances
data.frame in R
Name Balance
Bob 90
Ted 170
Bill 50
I want to execute mysql replace equivalent so that my table is updated to reflect new balances
Desired table in DB
Name Balance
Bob 90
Ted 170
Carl 130
Bill 50
I am currently using the RMySQL package - I tried to do this with dbWriteTable, but cannot make it work.
Eg1 ("Paste")
dbWriteTable(dbConnection, 'tableName', df, row.names=F, append=T)
Gives out
Name Balance
Bob 100
Ted 150
Carl 130
Bill 50
Eg2 ("Overwrite")
dbWriteTable(dbConnection, 'tableName', df, row.names=F, append=F, overwrite=T)
Gives out
Name Balance
Bob 90
Ted 170
Bill 50
How do i replace?