(To be submitted to the R Journal)
Use targets
and capsule
to recreate the paper.
targets
is the workflow system that ensures the steps required to complete the paper are completed in the right order. This is used as there is a computation (fitting many GAM models) that takes about 2-3 hours.capsule
locks in the R package versions, including where they were downloaded from (github or CRAN, for example), so that these can be locked in. Under the hood it uses Rstudio'srenv
R package.
There are three steps to reproduce the paper
install.packages(
"capsule",
repos = c(mm = "https://milesmcbain.r-universe.dev", getOption("repos")))
capsule::reproduce_lib()
This recreates all of the R packages used in the analysis on your computer. Importantly, this will not change where your existing R packages are installed. It is just for this repository. So no need to be concerned about this impacting other analyses you run.
capsule::run(targets::tar_make())
This runs our targets workflow using the R packages specified.
This will check if the targets are written, and if they aren't, it will re-run the necessary ones. In this case, the targets are stored in the _targets/objects
folder, so the paper should just be created - it will be in paper/brolgar-paper.html
or paper/brolgar-paper.pdf
.
Make some changes to the paper and want to see them? Run the capsule again:
capsule::run(targets::tar_make())
And the paper will be recreated.