New versions. Doesn’t everybody love them?
Right.
Sometimes you upgrade because a package you want is only available for a new version. Which works nicely. Then, however, after getting new versions of lots of things you find the dreaded ‘not available for R version 3.x’ for an old favourite.
All is not necessarily lost, having just done the following on a newer laptop this afternoon:
Install the devtools package.
Then, for a meta-example:
devtools::install_github("hadley/devtools")
with the package you have discovered on github’s user and repo name substituted for hadley/devtools.
Now, this may not be useful if there is no github version.
However, if there is an older package on R Forge then you may be able to install via SVN checkout.
As far as operating systems go, you will need to be able to use SVN, that is, sudo apt get subversion in this case. Or Windows equivalent.
svn checkout svn://svn.r-forge.r-project.org/svnroot/returnanalytics/
If there are multiple packages you want in that repository, then pick one:
R --vanilla CMD INSTALL --build returnanalytics/pkg/PortfolioAnalytics
If there is only one package in the repo, then :-
R --vanilla CMD INSTALL --build backagainanalytics/pkg
Yet another possibility is an R package being removed from CRAN and put in the archive, for whatever reason. In that case:
url <- "https://cran.r-project.org/src/contrib/Archive/hydrosanity/hydrosanity_0.8.76.tar.gz"
packagefile <- "hydrosanity_0.8.76.tar.gz"
download.file(url = url, destfile = packagefile)
# Install the dependencies
install.packages(c("cairoDevice"))
install.packages(c("playwith", "RGtk2", "gWidgets"))
# Install package
install.packages(pkgs=pkgFile, type="source", repos=NULL)
# Delete package file
unlink(packagefile)
Richard