| tar_target_path | R Documentation |
targets dependencyUse as the script, pre_script, or post_script argument of tar_target_py()/tar_target_jl()/tar_target_rs() (and their _raw forms) instead of a literal path string, to make that step re-run whenever the script file changes. name is the name of an upstream targets target (typically one created with format = "file" tracking the script file), and its value (the file path) is substituted in when the pipeline runs.
tar_target_path(name)
name |
Character string, the name of an upstream target whose value is the script's file path (e.g. a |
This mirrors how inputs = c(x = "some_target") already wires an upstream target in by name: the target's name is given as a string, and the constructor turns it into a real dependency. A plain string passed directly as script/pre_script/post_script keeps meaning what it always has (an untracked literal path), so existing pipelines are unaffected.
An object marking name for dependency-wiring by the tar_target_* constructors.
tar_target_py(), tar_target_jl(), tar_target_rs()
# Building a target does not run it, so this example needs no Python.
# python/fit_step.py:
# result = sum(x)
# scripts/pre.R:
# to_py <- list(x = x)
list(
targets::tar_target(fit_pyscript, "python/fit_step.py", format = "file"),
tar_target_py(
name = fit,
script = tar_target_path("fit_pyscript"), # re-runs when the file changes
pre_script = "scripts/pre.R", # untracked literal path
inputs = c(x = "prepared_x"),
retrieve = "result"
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.