使用RMySQL插入R数据帧时,dbWriteTable失败,列的行名未知

时间:2019-06-13 22:18:40

标签: mysql r rmysql

尝试使用以下代码将数据帧插入MySQL。

数据框: q <-data.frame(...)

      import_id     time     xpos     ypos     zpos     gaps      xvel          yvel       zvel trajectory runs
22651         2 188.7500 0.198364 0.484194 0.121778 0.000000 0.0000000  0.0000000000  0.0000000          0    1
22652         2 188.7583 0.200871 0.484247 0.119759 0.008333 0.3008520  0.0063602544 -0.2422897          1    6
22653         2 188.7667 0.203763 0.484246 0.117860 0.008334 0.3470122 -0.0001199904 -0.2278618          1    6
22654         2 188.7750 0.206539 0.484070 0.115836 0.008333 0.3331333 -0.0211208448 -0.2428897          1    6
22655         2 188.7833 0.209603 0.483557 0.113943 0.008333 0.3676947 -0.0615624625 -0.2271691          1    6
22656         2 188.7917 0.212570 0.482920 0.111810 0.008334 0.3560115 -0.0764338853 -0.2559395          1    6

RMySQL代码:

dbWriteTable(conn = mysql_conn, name = "master", value = q, 
                          append = TRUE, overwrite = FALSE, row.names = TRUE, 
                          field.types = list(import_id="int(11)", time="float(15,8)", 
                                           xpos = "float(15,8)", ypos = "float(15,8)", zpos = "float(15,8)",
                                           gpas = "float(15,8)", xvel = "float(15,8)", yvel = "float(15,8)",
                                           zvel = "float(15,8)", trajectory = "int(11)", runs = "int(11)"))

错误:

  

.local(conn,statement,...)中的错误:无法运行语句:   “字段列表”中的未知列“ row_names”

0 个答案:

没有答案