Updating packages on a drat repo

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.

  1. Create the source file for the package you want to host on the drat repo using devtools::build().
  2. Clone the drat repo hosting the package (in my case https://github.com/alan-y/drat).
  3. 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 the PACKAGES file that contains details on the packages hosted in the drat repo.
  4. 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:


If you want the drat repo to be available at startup drat::add() or drat::addRepo() can be added to a .Rprofile file.

Alan Yeung
Research Fellow and Analyst

Applied statistician, currently working mainly on blood borne viruses. Supporter of all things R.