2015-05-24
The drat package makes it trivially easy to deploy package repositories. There are essentially just two ways to use a package repository:
This vignette deals with the second case: How to use drat as package users. A companion vignette for package authors is available as well.
drat makes it very easy to use an R package repository hosted on GitHub. It assumes simply that the R package repository is hosted in a GitHub repository named drat
. With that, we only need one piece of information: the name of the repository (and if this seem mysterious see the discussion in the companion vignette. So
::addRepo("eddelbuettel") drat
adds my drat repo (which contains only the drat package in order to keep the footprint of forking small).
One can add several repositories at once. The following statements adds the repo for Rcpp and my catch-all ghrr repo:
::addRepo(c("eddelbuettel", "RcppCore", "ghrr")) drat
Note that this use a vectorised first argument, rather than three arguments.
Sometimes we want to use repositories not conforming to the GitHub drat
pattern. This use case may simply be a different URL, or server. Another common (and very useful case) is for a locally hosted repository.
In this case we use the two argument form: the first argument sets the name within the repos
vector, and the second provides the local (filesystem-based) or remote (web-based) URL:
::addRepo("workgroup", "file://nfs/groups/groupABC/R/drat") drat
where the same local network repository example is used as in the example in the companion vignette. Note that we start the location URL with file:
.
drat makes it very easy to register additional package repositories. One or more calls to drat::addRepo()
is all that it takes as shown above. After that, one can use install.packages()
or update.packages()
just as before, but with the additional repositories at one’s disposal.