3

I have a package called rpackage on a local (corporate) repo. When I run install.packages("rpackage") it tells me that:

Installing package(s) into ‘C:/Program Files/R/R-2.15.2/library’
(as ‘lib’ is unspecified)
Warning in install.packages :
  package ‘rpackage’ is not available (for R version 2.15.2)

I have built this package using R CMD INSTALL --build . , released to the local repo and also ran tools::write_PACKAGES() to update the PACKAGES files. When I run R --version I get:

R version 2.15.2 (2012-10-26) -- "Trick or Treat"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i386-w64-mingw32/i386 (32-bit)

And when I run R CMD INSTALL --build --version I get:

R add-on package installer: 2.15.2 (r61015)

The local repo directory structure follows the official documentation and has been working until I updated to R 2.15.2. The structure is:

\\server\folder\R\bin\windows\contrib\
    2.11\
    2.12\
    2.13\
    2.14\
    2.15\
\\server\folder\R\src\contrib\

If I run install.packages("rpackage") in R 2.15.1 I have no problems. Is there something special I need to do to get it to work with the new version of R?

I noticed the CRAN servers use a slightly different directory structure. For example, the CSIRO CRAN mirror uses:

http://cran.csiro.au/bin/windows/contrib/r-release/

Any idea about how to fix this?

Many thanks.

imanuelcostigan
  • 3,459
  • 3
  • 17
  • 19
  • Have you set up the local repository to work with R 2.15.2 setting the appropriate option for `repos`? install.packages gets the `repos` from `getOption('repos')` – mnel Oct 30 '12 at 03:25
  • Here's what I get `getOptions('repos')` for local repo entry: `file:////server/folder/r` – imanuelcostigan Oct 30 '12 at 03:34
  • As I mentioned in my post, no I don't get the error in 2.15.1 – imanuelcostigan Oct 30 '12 at 04:20
  • I meant is the `repos` option the same. – mnel Oct 30 '12 at 04:22
  • Sorry yes. The same for both. Both use the repo settings in `.Rprofile` as per [Hadley's README at github/devtools](https://github.com/hadley/devtools) – imanuelcostigan Oct 30 '12 at 06:06
  • I set up a totally new repo on my local drive. Added it to `.Rprofile` and released a clean bare bones package (using `package.skeleton` plus a daft function) and have same issue. I'm filing a bug report. – imanuelcostigan Oct 31 '12 at 06:00
  • The weird thing is that: `install.packages("//server/folder/r/bin/windows/contrib/2.15/rpackage.zip", repos=NULL)` works fine – imanuelcostigan Oct 31 '12 at 06:01
  • @imanuelc: having the same problem: http://stackoverflow.com/questions/13156426/did-the-subdirectory-structure-of-package-repositories-change-as-of-r-2-15-2. Did anything come back from r-devel yet (bug report)? – Rappster Oct 31 '12 at 14:47

3 Answers3

7

Unfortunately, neither the help files or the error message explained why this error was occurring. As it turns out, install.packages() also fails when the source package is not available, but the binary does. This is not documented behaviour (or more generously - it is not clearly documented):

For binary installs, the function also checks for the availability of a source package on the same repository, and reports if the source package has a later version, or is available but no binary version is. This check can be suppressed by options(install.packages.check.source = "no")

To fix, options(install.packages.check.source = FALSE). This can also be included in your .First function.

imanuelcostigan
  • 3,459
  • 3
  • 17
  • 19
2

I am not sure if imanuelc's solution will work for everyone, as it did not work for me:

> options(install.packages.check.source = FALSE)
> install.packages("rstudio", lib="C:/Program Files/R/R-2.15.2/library", dep=TRUE)
Warning in install.packages :
package ‘rstudio’ is not available (for R version 2.15.2)

In my case I've seen this error come and go for certain packages such as tm, rjson, etc. I know that there is a version of all of this packages for R 2.15 because most of them actually come with my IDE and I'm just trying to make them install into a particular directory (and I want the install.packages statement there for future coders with different IDE's).

I can't say that I know the root cause, but for me the work around is downloading the binaries directly from a mirror and installing them "manually" in the code.

Jason
  • 259
  • 3
  • 14
  • You have a lot of stuff that isn't really relevant for an answer. Also - is 'rstudio' a package you want to install or did you want to install the [RStudio IDE](http://www.rstudio.com/ide/download/)? – Dason Feb 21 '13 at 16:48
  • I think there *is* an `rstudio` package, but it's a weird one -- it comes with RStudio, and I don't know whether it's actually on any repositories or not. – Ben Bolker Feb 26 '13 at 19:35
1

Try upgrading R to the new version.

To do that first update sources.list file. You can do this by using following command:

nano /etc/apt/sources.list

add the following line to this file:

deb http://cran.r-project.org/bin/linux/debian/ wheezy-cran3/

Then do:

apt-get update

Remove older version:

apt-get remove r-base-core

Install using the command:

apt-get install r-base r-base-dev
fedorqui
  • 275,237
  • 103
  • 548
  • 598
aparna
  • 11
  • 1