Is it possible to insert (add) a row to a SQLite db table using dplyr package?

后端 未结 4 2006
时光说笑
时光说笑 2020-12-09 08:20

I am new to the database connection capabilities of dplyr package, but I am very interested in using it for an SQLite connection. I followed this tutorial and created an SQL

4条回答
  •  忘掉有多难
    2020-12-09 09:18

    No, you can do this all within dplyr.

    require(dplyr)
    
    my_db <- src_sqlite( "my_db.sqlite3", create = TRUE)                 # create src
    copy_to( my_db, iris, "my_table", temporary = FALSE)                 # create table
    newdf = iris                                                         # create new data
    db_insert_into( con = my_db$con, table = "my_table", values = newdf) # insert into
    

提交回复
热议问题