仅将唯一行添加到R

时间:2018-09-17 13:39:38

标签: r rsqlite

我有一个名为WVDList的表,存储在一个名为compFleet.db的sqlite数据库中。我在R中运行脚本以从API收集新数据,然后使用R中WVDList包中的函数将其追加到DBI

db_con <- dbConnect(RSQLite::SQLite(), "data/compfleet.db")
dbWriteTable(db_con, "WVDList", WVDList, append=TRUE)

但是,调用API有时会返回数据库中已经存在的记录。如何仅追加数据库表中不存在的那些行?

对API的每次调用通常返回超过1000,000行。列名是

c("mmsi", "lat", "lon", "rateOfTurn", "sogKts", "cog", "heading", 
"timestamp", "imoNumber", "dimensionToBow", "dimensionToStern", 
"dimensionToPort", "dimensionToStarboard", "etaMonth", "etaDay", 
"etaHour", "etaMinute", "draught", "name", "destination", "callsign"
)

0 个答案:

没有答案