This is just a small note (mainly for myself but hopefully may be of some use to a few others!) to remind of how to update a package on a drat repo.
- Create the source file for the package you want to host on the drat repo using
devtools::build()
. - Clone the drat repo hosting the package (in my case https://github.com/alan-y/drat).
- Use
drat::insertPackage("package-source.tar.gz", getwd())
to add the package to the drat repo (getwd()
works for me if my working directory is at the top level of the drat repo). Note this also updates thePACKAGES
file that contains details on the packages hosted in the drat repo. - Git push the package to all branches (master and gh-pages) using
git push origin --all
. It is particularly important that changes are pushed to the gh-pages branch in order for this to work.
After this, packages can be installed using, for example:
drat::addRepo("alan-y")
install.packages("phstemplates")
If you want the drat repo to be available at startup drat::add()
or drat::addRepo()
can be added to a .Rprofile
file.