Load MacPorts SQLite3 when using RSQLite library

南笙酒味 提交于 2019-12-22 13:09:12

问题


I have a user defined function in SQLite (an aggregator that calculates the product) and it works fine outside R. But I'm on a Mac some of the time, which requires the MacPorts version of SQLite3 if you'd like to add your own functions/extensions.

Can I pick which SQLite3 that RSQLite loads? I don't see anything in the SQLite documentation.

Also, MacPorts appears to change my sqlite3 link to the MacPorts installed SQLite3:

mbp:~ richard$ which sqlite3
/opt/local/bin/sqlite3

But if I want to load the extension in SQLite3, I have to explicitly can the MacPorts version, like this:

mbp:~ richard$ /opt/local/bin/sqlite3 temp.sqlite

Is writing my own SQLite functions and combining them with R a lost cause? Thanks!


回答1:


Have you installed and loaded the RSQLite.extfuns package? It has a single function which loads the available functions:

db <- dbConnect(SQLite(), dbname = ":memory:")
init_extensions(db)

By default these are the Healy extensions.



来源:https://stackoverflow.com/questions/4173019/load-macports-sqlite3-when-using-rsqlite-library

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!