Function-oriented Make-like declarative workflows for R
targets 
Pipeline tools coordinate the pieces of computationally demanding analysis projects. The targets package is a Make-like pipeline tool for statistics and data science in R. The package skips costly runtime for tasks that are already up to date, orchestrates the necessary computation with implicit parallel computing, and abstracts files as R objects. If all the current output matches the current upstream code and data, then the whole pipeline is up to date, and the results are more trustworthy than otherwise.
Philosophy
A pipeline is a computational workflow that does statistics, analytics, or data science. Examples include forecasting customer behavior, simulating a clinical trial, and detecting differential expression from genomics data. A pipeline contains tasks to prepare datasets, run models, and summarize results for a business deliverable or research paper. The methods behind these tasks are user-defined R functions that live in R scripts, ideally in a folder called "R/" in the project. The tasks themselves are called “targets”, and they run the functions and return R objects. The targets package orchestrates the targets and stores the output objects to make your pipeline efficient, painless, and reproducible.
Prerequisites
- Familiarity with the R programming
Installation
If you are using targets with crew for distributed computing, it is recommended to use crew version 0.4.0 or higher.
r
install.packages("crew")
There are multiple ways to install the targets package itself, and both the latest release and the development version are available.
| Type | Source | Command | |----|----|----| | Release | CRAN | install.packages("targets") | | Development | GitHub | pak::pkg_install("ropensci/targets") | | Development | rOpenSci | install.packages("targets", repos = "https://dev.ropensci.org") |
Get started in 4 minutes
The 4-minute video at
Usage
To create a pipeline of your own:
functions for a pipeline and save them to R scripts (ideally in the"R/" folder of
your project).
- Call
use_targets()
to write key files, including the vital _targets.R file which
configures and defines the pipeline.
- Follow the comments in
_targets.Rto fill in the details of your
- Check the pipeline with
tar_visnetwork(),
run it with
tar_make(),
and read output with
tar_read().
More
functions
are available.
Documentation
- User manual: in-depth
targets. The most important chapters are
the
walkthrough,
help guide, and
debugging guide.
- Reference website: formal
targets.
Help
Please read the help guide to learn how best to ask for help using targets.
Courses
workshop by Joel Nitta exampleSelected talks
English
(4:08)targets. useR! 2025
Conference
(1:00:25).
with Joel Nitta and Eric
Scott. rOpenSci Community
Call (1:09:56).
pipelines.
R/Pharma 2023 (1:57:22).
pipelines. R/Medicine 2021 (15:33)
targets New York Open Statistical
Programming Meetup, December 2020 (1:54:28).
2021
by Mauro Lepore.
Español
Irene Cruz, R-Ladies Barcelona, 2021-05-25 (1:25:12).日本語
(1:04:10), Joel NittaExample projects
Keras model longitudinal model for clinical trial data analysis pipeline ConnectApps
a built-in Shiny app to visualize progress while a pipeline is running. Available as a Shiny module viatarwatch_ui()
and
tarwatch_server().
targetsketch: a Shiny
Deployment
sets up a pipeline to run on GitHub Actions. The minimal example demonstrates this approach.Extending and customizing targets
- R Targetopia: a collection of
targets. These
packages simplify
pipeline construction for specific fields of Statistics and data
science.
factories:
a programming technique to write specialized interfaces for custom
pipelines. Posts here
and here
describe how.
Code of conduct
Please note that this package is released with a Contributor Code of Conduct.
Citation
r
citation("targets")
To cite targets in publications use:
Landau, W. M., (2021). The targets R package: a dynamic Make-like function-oriented pipeline toolkit for reproducibility and high-performance computing. Journal of Open Source Software, 6(57), 2959, https://doi.org/10.21105/joss.02959
A BibTeX entry for LaTeX users is
@Article{, title = {The targets R package: a dynamic Make-like function-oriented pipeline toolkit for reproducibility and high-performance computing}, author = {William Michael Landau}, journal = {Journal of Open Source Software}, year = {2021}, volume = {6}, number = {57}, pages = {2959}, url = {https://doi.org/10.21105/joss.02959}, }
