RMySQL dbWriteTable with field.types

后端 未结 2 1200
野的像风
野的像风 2020-12-01 10:38

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

相关标签:
2条回答
  • 2020-12-01 11:14

    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)
    
    0 讨论(0)
  • 2020-12-01 11:19

    thats because of table name. do not use capital letters for mysql table name.

    0 讨论(0)
提交回复
热议问题