如何安装 ROracle 包?

How to install ROracle package?

我正在尝试使用 install.packages("ROracle") 安装 ROracle 包,但每次我收到此消息时 "Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘ROracle’"

These will not be installed

我找不到解决这个问题的方法,我该如何解决这个问题?

从过去 post。 How to install ROracle package on Windows 7?

从 oracle 下载二进制文件:http://www.oracle.com/technetwork/database/database-technologies/r/roracle/downloads/index.html

r中的运行以下命令,替换文件路径:

setwd('xxxxx')   # set to path of download
install.packages('ROracle_1.2-1.zip', repos = NULL)
Then load the library and use the package - you may have to change XXXX to whatever is in your TNS Names:

library('ROracle')
drv <- dbDriver("Oracle")
con <- dbConnect(drv, "USER GOES HERE", "PASSWORD GOES HERE", dbname='XXX')
test connection:

dbReadTable(con, 'DUAL')

能够从源代码安装并直接从 oracle 下载预编译的插件

你在 CentOS7 吗?

我已经解决这个问题很长时间了,不得不记录我的发现 here。但是小鸟's-eye查看过程是:

  1. 使用 yum.
  2. 安装 oracle instant-client
  3. 设置 OCI_LIBOCI_INC 环境变量。
  4. 运行 ldconfig.
  5. 致电install.packages('ROracle')

使用像 packrat 这样的合适的包管理工具也很有帮助,这样您就不必再经历这个过程了。