The targets
R package is a pipeline tool for reproducible computation in statistics and data science. This short example is the one from the 4-minute video on getting started with targets
. It also comes up in the walkthrough
and functions
chapters of the user manual.
Visit https://rstudio.cloud/project/3946303 to try out the code in a web browser. No download or installation required.
data.csv
: theairquality
dataset from thedatasets
package.R/functions.R
: custom R functions you define for the analysis._targets.R
: a special script to configure and define the pipeline.
library(targets)
to load the package.tar_manifest()
andtar_visnetwork()
to check the pipeline for correctness.tar_make()
or similar to run the pipeline.tar_read()
to read target output.
- Rerun
tar_make()
after changing nothing else. All targets will be skipped. - Change the contents of
data.csv
and then reruntar_make()
. All the targets will rerun. - Change only the
plot_model()
function inR/function.R
and then reruntar_make()
. Only theplot
target will rerun, and the rest will be skipped.