[R] Problems with modifying data in a MySQL database

Marcus Wurzer mwurzer at wu-wien.ac.at
Tue Jan 8 13:11:22 CET 2008


Using the package /RMySQL/ I have established a connection ('con1') to a MySQL-Database called 'mc'.
This database contains a table called 'mc_2000' which has 200000 observations on several
variables. One of these variables is called 'B5' (type 'double').
When I generate a numeric vector in R called 'B6' that has the same length as 'B5': How 
can I replace the values of 'B5' with the values of 'B6'? I tried

dbGetQuery(con1,
"UPDATE mc_2000 SET B5 = B6", B6)

but this doesn't work. The same applies to:

dbGetQuery(con1,
"REPLACE mc_2000(B5) VALUES(B6)", B6)

Any help would be appreciated very much.

Marcus Wurzer




More information about the R-help mailing list