I just find out about connecting database from MySQL to R using RMySQL package. As someone that hates to input data manually to table in MySQL, I find the features quite fascinating, but I have some limitation, dbWriteTable
is suppose to export your R data frame to table in MySQL db, but in my case they don't put the rows/records in the table, they only created table frame with the data type but zero rows. I tried to export more simple data frame with only 7 variables and 7 observant and they still won't read the rows, they only export table frame from my data frame. Why's so?
The code is like this:
con <- dbConnect(MySQL(), user = "user",
password = "pass",
dbname = "database",
host = "localhost",
port = 3306)
worldPhones <- data.frame(worldPhones)
dbWriteTable(con, "worldPhones", worldPhones, row.names = FALSE)
ps. I already tried to find the solution of this problem across all site and video but no one quite giving me the answer so I seek to get it from you guys, I hope one of you can find where's the problem is. Thanks beforehand.