How to not need user input for install.packages(type = “both”)

扶醉桌前 提交于 2019-12-10 19:57:12

问题


Normally, install.packages(..., type = "both") requires user input if there is a package that needs to be built from source.

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.

Is there a way to automatically click yes, or not require user input through some of the options to install.packages()?

Note: install.packages(..., type = "source") does not require user input, but it builds all packages, which is not the desirable behavior in this case.


回答1:


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".

Solution:

options(install.packages.compile.from.source = "always")
install.packages(c("feather","tidyr"), type = "both")


来源:https://stackoverflow.com/questions/51510644/how-to-not-need-user-input-for-install-packagestype-both

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!