简体   繁体   English

在 R 包中使用 dbDriver(“PostgreSQL”)

[英]using dbDriver(“PostgreSQL”) in R package

I'm trying to put together a small package that makes use of R's PostgreSQL package.我正在尝试组合一个使用 R 的PostgreSQL包的小包。 I understand that the way to use functionality from other packages is not to use library() but to import only single functions using namespacing.我知道使用来自其他包的功能的方法不是使用library()而是使用命名空间仅导入单个函数。 I'm having a hard time making this work, however.但是,我很难完成这项工作。

Here's the Imports section of my DESCRIPTION file:这是我的DESCRIPTION文件的Imports部分:

Imports: DBI,
RPostgreSQL

When I call当我打电话

DBI::dbDriver("PostgreSQL")

in a function in my package I get在我的包中的一个函数中,我得到

Error: Couldn't find driver PostgreSQL. Looked in:
* global namespace
* in package called PostgreSQL
* in package called RPostgreSQL

What am I missing?我错过了什么?

Using使用

RPostgreSQL::PostgreSQL()

instead of代替

DBI::dbDriver("PostgreSQL")

works.作品。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM