2

I'm trying to put together a small package that makes use of R's PostgreSQL package. I understand that the way to use functionality from other packages is not to use library() but to import only single functions using namespacing. I'm having a hard time making this work, however.

Here's the Imports section of my DESCRIPTION file:

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?

RoyalTS
  • 9,545
  • 12
  • 60
  • 101

1 Answers1

6

Using

RPostgreSQL::PostgreSQL()

instead of

DBI::dbDriver("PostgreSQL")

works.

RoyalTS
  • 9,545
  • 12
  • 60
  • 101
  • how do you connect to a db using an url , after `RPostgreSQL::PostgreSQL() step ` ; and how do you close this opened connection? – kRazzy R Dec 03 '18 at 02:52