4

I have this R code and i want to connect to a postgres db using the conf file:

con <- dbConnect(PostgreSQL(), groups='epl')

The postgresql.conf file contains:

#------------------------------------------------------------------------------
# CUSTOMIZED OPTIONS
#------------------------------------------------------------------------------

# Add settings for extensions here
[epl]
host='localhost'
port = 5432
dbname='rlearning'
user='user'
password='pass'

When I run the R code, i get this error:

Error in postgresqlNewConnection(drv, ...) : 
  unused argument(s) (groups = "epl")

1 Answer 1

8

If everything else fails, you can try reading the documentation and following the examples. For help(dbConnect), you find

# create an PostgreSQL instance and create one connection.
drv <- dbDriver("PostgreSQL")

# open the connection using user, passsword, etc., as
con <- dbConnect(drv, dbname = "postgres")

and this is where you add additional user, password, host, arguments.

It will also show you that there is no argument groups explaining the error you get.

Sign up to request clarification or add additional context in comments.

2 Comments

it's unclear to me how this conf file works; i was just trying out an example in a book, but this part is a bit blurry
Well psql may read it, but I do not think we ever added that to the package.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.