我想安装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脚本中调用。
new.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
有人可以帮忙吗?
R希望在该默认路径中安装软件包。该路径不存在,或者您没有对该路径的写权限。
(从您通过bash运行R脚本的角度来看)将库安装在其他位置(例如,在个人库中)不是问题。除非您在以后加载它们时遇到特殊问题,否则我不会担心这些库的安装位置。可能的含义是,如果您从其他用户运行脚本,则可能需要再次安装到该用户可以访问的路径中。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句