r_a*_*anb 6 user-input r install.packages
通常,install.packages(..., type = "both")如果有需要从源代码构建的包,则需要用户输入。
例如(目前,使用 R 3.5.1),install.packages(c("feather", "tidyr"), type = "both"))将从二进制安装 tidyr 并从源代码安装 Feather,只要用户在进行 Feather 安装时单击“是”。
有没有办法自动点击是,或者不需要用户通过一些选项输入 install.packages()?
注意: install.packages(..., type = "source")不需要用户输入,但它会构建所有包,在这种情况下这不是理想的行为。
该install.packages.compile.from.source选项可以设置为"always"从源安装软件包而不提示用户界面。默认为"interactive",使用时会提示用户确认type="both"。
解决方案:
options(install.packages.compile.from.source = "always")
install.packages(c("feather","tidyr"), type = "both")
Run Code Online (Sandbox Code Playgroud)