I have a data frame, called df
, that looks like this:
dte, val
2012-01-01, 23.2323
2012-01-02, 34.343
The type on the columns
After playing with things, I realized what the problem is: field.types
must be a NAMED list vector, not simply a list; additionally the row names must not be included otherwise we need three field types. For the above example, the following works fine:
dbWriteTable(con, name="table_name", value=df,
field.types = c(dte="date", val="double(20,10)"), row.names=FALSE)
thats because of table name. do not use capital letters for mysql table name.