This repo contains slides and code for the talk 'Hit your reproducibility {targets}' at the UK Government Data Science Festival on 29 September 2020.
You can view the slides in your browser (press F for fullscreen, P for presenter notes and O for a slide overview).
The {targets} package by Will Landau is an R-focused solution for managing your analytical workflows.
What does that mean? {targets} ‘remembers’ the relationships between objects in your workflow. When you update your analysis, {targets} makes sure that only the impacted objects are re-run. This means you don’t have to recreate everything from scratch each time.
This repo also includes files used as part of a {targets} demo used in the slides:
targets.R
contains the pipelinerun-pipeline-beavers.R
has code to execute and inspect the pipeline_targets/
is the cache of objects and metadata (like {targets} 'memory')report-beavers.Rmd
is a dummy R Markdown report to be rendered in the pipelinereport-beavers-mistake.html
is a rendered version of the R Markdown file, but it has an error!report-beavers.html
is the final rendered version of the R Markdown after the mistake is corrected
The slides describe an example using these materials, but in short:
tar_script()
creates a_targets.R
file, which is where you declare you write functions and options and create your targets withtar_targets()
, declaring the pipeline withtar_pipeline()
tar_manifest()
lets you check the configuration of your targetstar_visnetwork
visualises your pipeline as a graph networktar_make()
executes your pipeline, which caches outputs and metadata in a_targets/
directory that can be read from withtar_read()
andtar_load()
tar_outdated()
prints any targets that need to be updated following any changes to other targets, after which you can reinspect your pipeline and re-make it