Demo and examples of targets pipelines
Let’s look at our demo {targets} pipeline and, afterwards, some examples to see what a real-world pipeline looks like including figures, model, output, tables and a manuscript object.
Demo
With our example {targets} pipeline (open /projects/example-targets-workflow/example-targets-workflow.Rproj), and go through the following steps:
- Visualize the pipeline’s steps and interdependencies.
tar_visnetwork()- Run the workflow
tar_make()Explore the results
Look at the rendered manuscript document
Open the rendered document in the paper/ directory.
Now to make some changes
- Edit the raw-data file, for example by adding new rows to mimic more data being collected. Note: please do not edit raw data, this is just to illustrate how {targets} tracks external files for changes. Rerun
tar_make(). - Delete an output figure. Rerun
tar_make(). - Add a filter step before the group counts target. Rerun
tar_make().
- Edit the raw-data file, for example by adding new rows to mimic more data being collected. Note: please do not edit raw data, this is just to illustrate how {targets} tracks external files for changes. Rerun
Examples of real-world pipelines
Check out some examples of full {targets} pipelines that we’ve developed to get a sense for the various applications and approaches that can be used.
- data cleaning and preparation pipeline
- In this pipeline, we use the targets function
tar_cueto define how often the target should become stale and re-run, andfile.existsto check which of a large list of input files exist on the users computer for processing - movement ecology method (iSSA)
- We use
iteration = 'group'with a column named “tar_group” to run the analysis by defined chunks in the data e.g. individuals and years - Bayesian models with {brms}
- We use a custom target factory to prepare the pieces (e.g. priors, summaries, model fitting, model checks) that make up a complete Bayesian modeling approach
- Remote sensing and spatial application with {rgee}
- We use a multiline statement to filter images before sampling