Query:

I am trying to connect MySQL with R by referring the belowlink.

http://decisionstats.com/2011/10/16/using-r-with-mysql/

I used the below commands to create the table in MySQ using R.

Command: con<-odbcConnect("MySQL", uid="root", pwd="root",)

Command: sqlTables(con)

Command: data12<-sqlSave(con,as.data.frame(mydata1))

     

But this works if I want to insert the data into a new table. I would like to know how can we insert the data into an existing MySQL table.

Also please help me how can I update the existing the tables.


Answer:


We can do it with the help  of sqldf() function


Please refer to the below link in which instructor has addressed this query at 40 minutes with an example.

https://edureka.wistia.com/medias/grxue031zr


You may also refer to the below link that would guide about the Data imports using R

https://edureka.wistia.com/medias/lswvjz1y0p