How to not need user input for install.packages(type = "both")
Asked Answered
C

1

7

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.

Crassus answered 25/7, 2018 at 4:8 Comment(2)
Are you doing this from the command line, or from RStudio?Urtication
@Urtication I'm using R-studio, but this occurs in the standard R GUI as well. And I'm in need of the answer for an install through AppVeyor if that matters at all.Crassus
C
6

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")
Crassus answered 26/7, 2018 at 2:42 Comment(4)
Deleted my answer. This is much better.Stanfill
Is the option setting valid for the live R session or we need to run it every time?Jutta
Btw, I think it is options and not option: options(install.packages.compile.from.source = "always")Jutta
@Jutta - it would be valid for the entire R sessionCrassus

© 2022 - 2024 — McMap. All rights reserved.