如何不需要用户输入 install.packages(type = "both") [英] How to not need user input for install.packages(type = "both")
问题描述
通常情况下,install.packages(..., type = "both")
如果有需要从源代码构建的包,则需要用户输入.
Normally, install.packages(..., type = "both")
requires user input if there is a package that needs to be built from source.
例如(目前,使用 R 3.5.1),install.packages(c("feather", "tidyr"), type = "both"))
将从二进制和从源头开始,只要用户在进行羽毛安装时单击是".
For example (currently, with R 3.5.1), install.packages(c("feather", "tidyr"), type = "both"))
will install tidyr from binary and feather from source, as long as there is a user to click "yes" when it gets to the feather install.
有没有办法通过install.packages()
的一些选项自动点击是,或者不需要用户输入?
Is there a way to automatically click yes, or not require user input through some of the options to install.packages()
?
注意: install.packages(..., type = "source")
不需要用户输入,但它构建所有包,这不是理想的在这种情况下的行为.
Note: install.packages(..., type = "source")
does not require user input, but it builds all packages, which is not the desirable behavior in this case.
推荐答案
install.packages.compile.from.source
选项可以设置为 "always"
以从源代码安装软件包而不提示用户界面.默认为"interactive"
,使用type="both"
时会提示用户确认.
The install.packages.compile.from.source
option can be set to "always"
to install packages from source without prompting for UI. The default is "interactive"
, which will prompt for user confirmation when using type="both"
.
解决方案:
options(install.packages.compile.from.source = "always")
install.packages(c("feather","tidyr"), type = "both")
这篇关于如何不需要用户输入 install.packages(type = "both")的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!