general-development-workflow.Rmd
Interactive development of new functions and reports is easy using devtools
. Any R code (functions etc) go in the R
folder of the package root. A good convention to follow is to have one file per function, however if you have a collection of related functions it may be best to keep them together. Please see later on how to document and test your functions. The latest code can be loaded into the R session (as if you had built, installed, and attached the package) by using the devtools::load_all()
function. A useful shortcut for this inside RStudio is ctlr+shift+L
.
Here’s an example workflow for adding a function to the package step by step
function_name.R
script in the R
directoryctlr+shift+L
R
sessionOnce you are happy with your addition to the package you can build a source version for others to install and use with the following function.
devtools::build()
If you are are adding or modifying a vignette (built in report) then make sure you build with the following argument
devtools::build(vignettes = TRUE)
The vignettes are slow to build so I suggest only running them when you are working on the vignettes.