使用R连接到PostgreSQL(在Windows中)

Adr*_*n M 4 postgresql r

我有这个R代码,我想使用conf文件连接到postgres数据库:

con <- dbConnect(PostgreSQL(), groups='epl')
Run Code Online (Sandbox Code Playgroud)

postgresql.conf文件包含:

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

# Add settings for extensions here
[epl]
host='localhost'
port = 5432
dbname='rlearning'
user='user'
password='pass'
Run Code Online (Sandbox Code Playgroud)

当我运行R代码时,我收到此错误:

Error in postgresqlNewConnection(drv, ...) : 
  unused argument(s) (groups = "epl")
Run Code Online (Sandbox Code Playgroud)

Dir*_*tel 7

如果其他一切都失败了,您可以尝试阅读文档并按照示例进行操作.因为help(dbConnect),你找到了

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

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

这是您添加其他用户,密码,主机,参数的地方.

它还将向您显示没有参数groups解释您得到的错误.