Using sqldf and RPostgreSQL together

后端 未结 2 1920
说谎
说谎 2020-12-31 05:38

When using RPostgreSQL I find that I cannot use sqldf in the same way. For example if I load the library and read in data into a data frame using t

相关标签:
2条回答
  • 2020-12-31 05:49

    I had the same error and I detached the RPostgeSQL package, rerun my sqldf code and it worked fine r detach("package:RPostgreSQL", unload=TRUE)

    0 讨论(0)
  • 2020-12-31 05:57

    Using sqldf with RPostgreSQL

    sqldf will automatically work with the test database in PostgreSQL if it sees that RPostgreSQL is loaded. So you can create a test database in PostgreSQL and then use sqldf with that

    or, you can specify the name of a different database.

    See: sqldf FAQ 12

    Using sqldf with RSQLite

    If you want to use sqldf with RSQLite rather than with RPostgreSQL you can use sqldf's drv argument to force it use a non-default driver. e.g.

    sqldf("select foo from bar...",drv="SQLite")
    

    or, you can set the driver globally using the "sqldf.driver" option. From within R:

    options(sqldf.driver = "SQLite")
    

    or, another possibility if you wish to use RSQLite is to detach RPostgreSQL before you use sqldf and load it again afterwards.

    See ?sqldf for details.

    0 讨论(0)
提交回复
热议问题