Prefer install packages from binaries in Windows

Hello,
Does anyone know of way to tell R in Windows to install from binaries whenever possible?

Despite binaries being the default choice for install.packages in Windows, whenever the binary version is older than the source one, the following prompt appears:

"There are binary versions available but the source versions are later"

and the package gets installed from source instead. This happens even when I set:
options(install.packages.check.source = "no")
which according to the docs it just suppresses the check (not the choice of installing from source)

Bear in mind I am issuing this instruction unattended so, I cannot make an interactive choice to potential prompts.

I am prioritizing the binary install even if it's not the latest version.

Many thanks

Try install.packages( c("your","list","of","packages"), type="binary") that should force only binaries to be installed.

Other Options

Looking through ?options it appears there are a couple that might produce the behavior you're looking for.

install.packages.compile.from.source

Setting install.packages.compile.from.source to "interactive" should prompt you for the decision interactively.

options(install.packages.compile.from.source = "interactive")

From the docs:

Used by install.packages(type = "both") (and indirectly update.packages) on platforms which support binary packages. Possible values are "never", "interactive" (which means ask in interactive use and "never" in batch use) and "always". The default is taken from environment variable R_COMPILE_AND_INSTALL_PACKAGES, with default "interactive" if unset. However, install.packages uses "never" unless a make program is found, consulting the environment variable MAKE.

pkgType

Another one to try as it appears to specify the behavior and wouldn't require interactive prompts.

options(pkgType = "win.binary")

From the docs:

pkgType:
The default type of packages to be downloaded and installed – see install.packages. Possible values are platform dependently

on Windows: "win.binary", "source" and "both" (the default).

2 Likes

Grosscol,
That's neat. Setting:
options(install.packages.compile.from.source = "never")

has nailed it.

Packages for which the source version is greater than the binary one, are now downloaded and installed from binaries when running install.packages unnatended

Many thanks

If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.