Cannot Install R-Forge Package Using Install.Packages

Cannot install R-forge package using install.packages

R-Forge may fail to build a package for a few different reasons. It could be that
the documentation has not been updated to reflect recent changes in the code. Or,
it could be that some of the dependencies were not available at build time.

You can checkout the source code using svn. First, search for the project on the
R-Forge website and go to the project home page -- for example http://r-forge.r-project.org/projects/returnanalytics/
Click the SCM link to get to a page like this http://r-forge.r-project.org/scm/?group_id=579

This page will tell you the command to use to checkout the project. In this case you get

This project's SVN repository can be checked out through anonymous access with the following command(s).

svn checkout svn://svn.r-forge.r-project.org/svnroot/returnanalytics/

If you are on Windows, you probably want to download and install TortoiseSVN

Once you have installed TortoiseSVN, you can right click in a Windows Explorer window and select
"SVN checkout". In the "URL of repository:" field, enter everything except the
"svn checkout " part of the command that you found on R-Forge. In this case, you'd
enter "svn://svn.r-forge.r-project.org/svnroot/returnanalytics/".

When you click OK, the project will be downloaded into the current directory.

If you are on a UNIX-alike system (or if you installed the command line client tools
when you installed TortoiseSVN for Windows, which is not the default), you can
type the command that R-forge gave you in your terminal (System terminal, not the R terminal)

svn checkout svn://svn.r-forge.r-project.org/svnroot/returnanalytics/

That will create a new directory under the current working directory that
contains all of the files in the package. In the top level of that directory
will be a subdirectory called "pkg". This particular project (returnanalytics)
contains more than one package.

ls returnanalytics/pkg
#FactorAnalytics MPO PApages PerformanceAnalytics PortfolioAnalytics

But some R-forge projects only have a single package. e.g.

svn checkout svn://svn.r-forge.r-project.org/svnroot/random/
#Checked out revision 14.
ls random/pkg
#DESCRIPTION inst man NAMESPACE R

Now that you have a local copy all of the code, if you would like to be able to
install the package, you have to build it first.

A WORD OF CAUTION: Since R-Forge failed to build the package, there is a good chance
that there are problems with the package. Therefore, if you just build it, you may find
that some things do not work as expected. In particular, it is likely that there
is missing or incomplete documentation.

If you are on a UNIX-alike system, the package can be built and installed relatively easily. For a multi-package project like returnanalytics, if you want to install, e.g. the
PortfolioAnalytics package, you can do it like this

R --vanilla CMD INSTALL --build returnanalytics/pkg/PortfolioAnalytics 

"PortfolioAnalytics" is the name of the directory that contains the package that
you want to build/install. For a single-package project, you can build and install like
this

R --vanilla CMD INSTALL --build random/pkg

If you would like to build/install a package on Windows, see this question and follow the two links that @JoshuaUlrich provided

More information can be found in R Installation and Administration, the R-Forge User Manual, and the SVN manual.

Installation Error When Installing Package from R Forge

To clarify @DWin's and Gabor's answers slightly more:

You are running into trouble because R-forge only builds binaries for the current (2.14 right now) and development ("2.15", but Brian Ripley will probably get mad if you refer to it that way) versions of packages. In this situation you have the following options:

  • Upgrade R to the current version (the best idea).

If you have good reasons you can't do that (you don't have administrative rights, you are running a critical analysis that depends on a previous version of R, you need to use Revolution R because of its extensions etc.), then you can try one of the following:

  • (as suggested by @jthetzel's comment above) follow the links to the binary version of the package, download the binary file (zip in the case of Windows), and try installing from the local copy (with repos=NULL, or from the appropriate menu entry). This will not work if the package depends, implicitly or explicitly, on features in the latest version of R.
  • try to install the source version of the package: install.packages("thispkg",repos="http://r-forge.r-project.org",type="source"). This will only work if (1) you have the tools for compiling packages from source installed (see the R manual, or (for Windows) the R for Windows FAQ, google for "Rtools", etc., or (for MacOS) the R for MacOS FAQ) or (2) the package contains only R code, not compiled C/FORTRAN code (not true in the case of the zoo package, I think).
  • download the source package, unpack it, modify the DESCRIPTION file so that the maintainer e-mail is your own, rebuild the source package, and upload it to the CRAN win-builder service. (If you don't modify the DESCRIPTION file then you won't be informed that the package has been built and where to download it -- you'll just annoy and confuse the maintainer of the package, who will receive the e-mail.) (This only works for Windows.)

Some of the resistance you've been getting is directed less at you than at Revolution R. There's nothing wrong (I don't think) with their making money from R, but when providing support for Revolution R adds to the workload of the R community (ordinarily we would just say "upgrade to the latest version of R" and be done with it), people get a little grumpy.

https://r-forge.r-project.org/ and packages from it are not working

Mail received on June 4 2018:

Dear r-forge users,

We would like to remind you, that r-forge will be unavailable
presumably from Jun 5th to Jun 7th due to major maintenance works.

Best regards, R-Forge team.

How to install R packages that are not available in R-essentials?

Now I have found the documentation:

This is the documentation that explains how to generate R packages that are only available in the CRAN repository:
https://www.continuum.io/content/conda-data-science

Go to the section "Building a conda R package".

(Hint: As long as the R package is available under anaconda.org use this resource. See here: https://www.continuum.io/blog/developer/jupyter-and-conda-r)

alistaire's answer is another possibility to add R packages:

If you install packages from inside of R via the regular install.packages (from CRAN mirrors), or devtools::install_github (from GitHub), they work fine. @alistaire

How to do this:
Open your (independent) R installation, then run the following command:

install.packages("png", "/home/user/anaconda3/lib/R/library")

to add new package to the correct R library used by Jupyter, otherwise the package will be installed in /home/user/R/i686-pc-linux-gnu-library/3.2/png/libs mentioned in .libPaths() .

How should I deal with package 'xxx' is not available (for R version x.y.z) warning?

1. You can't spell

The first thing to test is have you spelled the name of the package correctly? Package names are case sensitive in R.


2. You didn't look in the right repository

Next, you should check to see if the package is available. Type

setRepositories()

See also ?setRepositories.

To see which repositories R will look in for your package, and optionally select some additional ones. At the very least, you will usually want CRAN to be selected, and CRAN (extras) if you use Windows, and the Bioc* repositories if you do any biological analyses.

To permanently change this, add a line like setRepositories(ind = c(1:6, 8)) to your Rprofile.site file.


3. The package is not in the repositories you selected

Return all the available packages using

ap <- available.packages()

See also Names of R's available packages, ?available.packages.

Since this is a large matrix, you may wish to use the data viewer to examine it. Alternatively, you can quickly check to see if the package is available by testing against the row names.

View(ap)
"foobarbaz" %in% rownames(ap)

Alternatively, the list of available packages can be seen in a browser for CRAN, CRAN (extras), Bioconductor, R-forge, RForge, and GitHub.

Another possible warnings message you may get when interacting with CRAN mirrors is:

Warning: unable to access index for repository

Which may indicate the selected CRAN repository is currently be unavailable. You can select a different mirror with chooseCRANmirror() and try the installation again.


There are several reasons why a package may not be available.


4. You don't want a package

Perhaps you don't really want a package. It is common to be confused about the difference between a package and a library, or a package and a dataset.

A package is a standardized collection of material extending R, e.g. providing code, data, or documentation. A library is a place (directory) where R knows to find packages it can use

To see available datasets, type

data()

5. R or Bioconductor is out of date

It may have a dependency on a more recent version of R (or one of the packages that it imports/depends upon does). Look at

ap["foobarbaz", "Depends"]

and consider updating your R installation to the current version. On Windows, this is most easily done via the installr package.

library(installr)
updateR()

(Of course, you may need to install.packages("installr") first.)

Equivalently for Bioconductor packages, you may need to update your Bioconductor installation.

source("http://bioconductor.org/biocLite.R")
biocLite("BiocUpgrade")

6. The package is out of date

It may have been archived (if it is no longer maintained and no longer passes R CMD check tests).

In this case, you can load an old version of the package using install_version()

library(remotes)
install_version("foobarbaz", "0.1.2")

An alternative is to install from the GitHub CRAN mirror.

library(remotes)
install_github("cran/foobarbaz")

7. There is no Windows/OS X/Linux binary

It may not have a Windows binary due to requiring additional software that CRAN does not have. Additionally, some packages are available only via the sources for some or all platforms. In this case, there may be a version in the CRAN (extras) repository (see setRepositories above).

If the package requires compiling code (e.g. C, C++, FORTRAN) then on Windows install Rtools or on OS X install the developer tools accompanying XCode, and install the source version of the package via:

install.packages("foobarbaz", type = "source")

# Or equivalently, for Bioconductor packages:
source("http://bioconductor.org/biocLite.R")
biocLite("foobarbaz", type = "source")

On CRAN, you can tell if you'll need special tools to build the package from source by looking at the NeedsCompilation flag in the description.


8. The package is on GitHub/Bitbucket/Gitorious

It may have a repository on GitHub/Bitbucket/Gitorious. These packages require the remotes package to install.

library(remotes)
install_github("packageauthor/foobarbaz")
install_bitbucket("packageauthor/foobarbaz")
install_gitorious("packageauthor/foobarbaz")

(As with installr, you may need to install.packages("remotes") first.)


9. There is no source version of the package

Although the binary version of your package is available, the source version is not. You can turn off this check by setting

options(install.packages.check.source = "no")

as described in this SO answer by imanuelc and the Details section of ?install.packages.


10. The package is in a non-standard repository

Your package is in a non-standard repository (e.g. Rbbg). Assuming that it is reasonably compliant with CRAN standards, you can still download it using install.packages; you just have to specify the repository URL.

install.packages("Rbbg", repos = "http://r.findata.org")

RHIPE on the other hand isn't in a CRAN-like repository and has its own installation instructions.



Related Topics



Leave a reply



Submit