Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

tar_reprex

Reproducible example of targets with reprex


Description

Create a reproducible example of a targets pipeline with the reprex package.

Usage

tar_reprex(pipeline = tar_target(example_target, 1), run = tar_make(), ...)

Arguments

pipeline

R code for the target script file _targets.R. library(targets) is automatically written at the top.

run

R code to inspect and run the pipeline.

...

Named arguments passed to reprex::reprex().

Details

The best way to get help with an issue is to create a reproducible example of the problem and post it to https://github.com/ropensci/targets/discussions tar_reprex() facilitates this process. It is like reprex::reprex({targets::tar_script(...); tar_make()}), but more convenient.

Value

A character vector of rendered the reprex, invisibly.

See Also

Examples

if (identical(Sys.getenv("TAR_INTERACTIVE_EXAMPLES"), "true")) {
tar_reprex(
  pipeline = {
    list(
      tar_target(data, data.frame(x = sample.int(1e3))),
      tar_target(summary, mean(data$x, na.rm = TRUE))
    )
  },
  run = {
    tar_visnetwork()
    tar_make()
  }
)
}

targets

Dynamic Function-Oriented 'Make'-Like Declarative Workflows

v0.10.0
MIT + file LICENSE
Authors
William Michael Landau [aut, cre] (<https://orcid.org/0000-0003-1878-3253>), Matthew T. Warkentin [ctb], Samantha Oliver [rev] (<https://orcid.org/0000-0001-5668-1165>), Tristan Mahr [rev] (<https://orcid.org/0000-0002-8890-5116>), Eli Lilly and Company [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.