I've been working on an Rmarkdown Template Package for a short while and I feel like I'm missing something. Currently whenever I make a change that I want to make sure works what I end up doing is:
Save all the files
Git add, Git Commit, Git push all my files to github
devtools::install_github() my package again to my computer.
Close project and and test knitting a document to see if it worked.
I know I'm missing something. Can someone enlighten me or point me towards some resources on an efficient package development workflow. I've seen the Package Development books by Hadley & co. Any other resources?
Hi @dylanjm, the main book I use is this one: http://r-pkgs.had.co.nz/, additionally, a look at the tidyverse GitHub repos to learn by example. For testing, the testthat package will be the main vehicle for unit testing, that is described in this section of the book: http://r-pkgs.had.co.nz/tests.html. Another great resource is to add Travis CI integration to your repo, it will test in multiple R versions for you, as well as will run the tests in Linux, here is a great intro guide by @julia : https://juliasilge.com/blog/beginners-guide-to-travis/
Just wanted to second @edgararuiz's plug for Travis CI. You can also use Travis to test on Mac at the same time as your Linux tests, and appveyor to test on Windows. That way you can cover all major operating systems! They both work similarly and trigger automatically off of new git commits / pull requests / etc. You can add them to your project easily with usethis::use_appveyor() and usethis::use_travis().
We have a package (INBOmd)[https://github.com/inbo/inbomd], which sounds very similar: it contains Rmarkdown and LaTeX templates.
We have set up Wercker (linux) and AppVeyor (windows). Both run the standard R CMD check routines after every push to the GitHub repo.
The Wercker version also clones and compiles a github repo called inbomd_examples. If any of those fail to compile then this failure is reported back to GitHub. Successful runs of the examples on the master branch of INBOmd are automatically deployed.
When the runs on the master branch at AppVeyor are successful, the package is automatically deployed (tar.gz and zip) to our drat repository.