我想安装 R 包 RPostgresql 以连接到我在 Centos 8 上名为“crex”的 PostgreSQL 数据库。当我运行
> install.packages("RPostgreSQL")
在终端中,我收到以下错误:
Installing package into ‘/usr/lib64/R/library’
(as ‘lib’ is unspecified)
Warning in install.packages("RPostgreSQL") :
'lib = "/usr/lib64/R/library"' is not writable
Would you like to use a personal library instead? (yes/No/cancel)
从我收集到的消息中,我需要设置一个个人库,但我不确定其含义。我要做的是运行 ar 脚本,例如 new.r,它将从另一个 bash 脚本中调用。
新的.r:
require("RPostgreSQL")
pw <- {
"XXXX"
}
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, dbname = "crex",
host = "localhost", port = 5432,
user = "postgres", password = pw)
rm(pw)
dbExistsTable(con, "work")
#other commands
Bash 脚本 b.txt:
#!/bin/bash
Rscript new.r
#other commands
有人可以帮忙吗?