作者:芬妮诗婚纱厂 | 来源:互联网 | 2023-08-16 17:55
I'm really stuck here. I created a SQLite db on the Mac OSX, and now am trying to INSERT data into it on Windows. I'm doing it in R on both platforms, using the RSQLite library.
我真的被困在这里了。我在Mac OSX上创建了一个SQLite数据库,现在正试图在Windows上将数据插入其中。我在两个平台上使用RSQLite库在R中执行此操作。
I'm trying to insert the data from data frame x
:
我正在尝试从数据框x插入数据:
> str(x)
'data.frame': 6 obs. of 12 variables:
$ Julian : int ...
$ Date : chr ...
$ Time : chr ...
$ ID : chr ...
$ Item : chr ...
$ Value : num ...
$ Payment : chr ...
$ Type : chr ...
$ Customer : chr ...
$ Operator1: chr ...
$ Operator2: chr ...
$ Weekday : int ...
I try the following steps and get the error message below:
我尝试以下步骤并获得以下错误消息:
> db=dbConnect(dbDriver("SQLite"),dbname=f)
> dbSendQuery(db,"INSERT INTO Entries VALUES(?,?,?,?,?,?,?,?,?,?,?,?)",x)
Error in .local(conn, statement, ...) :
unused argument (list( ... ))
UPDATE: The suggestion below by vaettchen of using dbWriteTable with append=TRUE worked, thanks. However, there is still an issue with dbSendQuery, see error below when trying to remove all entries with id=74:
更新:vaettchen下面的建议使用dbWriteTable和append = TRUE工作,谢谢。但是,dbSendQuery仍然存在问题,在尝试删除id = 74的所有条目时请参阅以下错误:
> dbSendQuery(db,"DELETE FROM Entries WHERE ID=?",id)
Error in .local(conn, statement, ...) : unused argument (74)
Appreciate any help, it might just be something stupid I can't see. Many thanks.
感谢任何帮助,它可能只是一些我看不到的愚蠢。非常感谢。
1 个解决方案