Reputation: 4474
I am working on a Windows 7 machine without internet access. As yet, I got around the missing internet connection by creating a local copy of the binary CRAN repository in //server/x/bin/windows/contrib/3.1
, then running write_PACKAGES("//server/x/bin/windows/contrib/3.1")
and finally setting r["CRAN"]="file:////server/x";r["CRANextra"]=r["CRAN"];
in C:/Program Files/R/R-3.1.2/etc/Rprofile.site
.
But this does not work any longer since R 3.2.1. The path in the error message of install.packages
indicates that R is looking for the source package:
Cannot open compressed file '//server/x/src/contrib/PACKAGES'
I have thought that R on Windows only looks for binary packages!
Looking at a diff between install.packages
for 3.1.2 and 3.2.1, I can see quite a few changes. However, the source code for the function has 500+ lines which makes it hard for me to see where specifically the problem lies.
I have tried to set
options(install.packages.check.source="no")
and to explicitly add type="win.binary"
to install.packages
- both without success.
It is also interesting that
contrib.url(options("repos")$repos["CRAN"],type="win.binary")
gives the correct path file:////server/x/bin/windows/contrib/3.2
but somehow this is not used by install.packages(...,type="win.binary")
...
So my question is whether you guys have experienced similar problems?
If no, I would be grateful for any pointers to mistakes I could have made.
Upvotes: 1
Views: 567
Reputation: 4474
I have found the problem. The R 3.2.1 NEWS section (https://cran.r-project.org/src/base/NEWS) says
- The default for option pkgType on platforms using binary packages is now "both", so source packages will be tried if binary versions are not available or not up to date.
The problem is that RStudio does not directly call install.packages
but via a few other functions such as .rs.callAs
. In one of these functions, available.packages()
gets called without any arguments. So it determines the argument type
via getOption("pkgType")
. But since R 3.2.1 this is now "both"
and not "win.binary"
as in R 3.1.2.
A quick workaround for the problem is thus to add
options(pkgType="win.binary")
to the yourRinstallpath/etc/Rprofile.site
Upvotes: 4