[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.
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.
- 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.
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.