Updating packages on a drat repo

May 2, 2020
By

[This article was first published on R on Alan Yeung, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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:

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.

To leave a comment for the author, please follow the link and comment on their blog: R on Alan Yeung.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)