传递configure参数以在R中安装软件包

cmo*_*cmo 8 r install.packages

我正在尝试R从CRAN存储库安装一个包.我必须在配置阶段传递一个标志,但我无法弄清楚如何在以下位置执行此操作install.packages:

> install.packages("Rmpfr")

..........
checking mpfr.h usability... no
checking mpfr.h presence... no
checking for mpfr.h... no
configure: error: Header file mpfr.h not found;
**maybe use --with-mpfr-include=INCLUDE_PATH**
Run Code Online (Sandbox Code Playgroud)

(注意:我在自定义位置安装了MPFR,因为我不是root用户).

但是如何将带有参数的特定标志传递给install.package命令R .eg"--with-mpfr-include =/path/to/mpfr/include"

基于install.packages手册页,我尝试过:

install.packages("Rmpfr" , INSTALL_opts = "--with-mpfr-include=/path/to/mpfr/include")

install.packages("Rmpfr" , configure.args = "--with-mpfr-include=/path/to/mpfr/include")

install.packages("Rmpfr" , configure.vars = "--with-mpfr-include=/path/to/mpfr/include")
Run Code Online (Sandbox Code Playgroud)

但是没有一个工作,同样的错误.

tom*_*fer 13

在这个问题,我只是偶然自己,试图安装udunits2作为一个依赖ggforce.R devel邮件列表中的这个答案适用于我的情况:我需要传递一个命名的字符向量来configure.args键入包名称.这应该适用于您的情况,然后:

install.packages("Rmpfr",
  configure.args = c(Rmpfr = "--with-mpfr-include=/path/to/mpfr/include"))
Run Code Online (Sandbox Code Playgroud)