Define a target using unrefined names and language objects.
tar_target_raw()
is just like tar_target()
except
it avoids non-standard evaluation for the arguments: name
is a character string, command
and pattern
are language objects,
and there is no tidy_eval
argument. Use tar_target_raw()
instead of tar_target()
if you are creating entire batches
of targets programmatically (metaprogramming, static branching).
tar_target_raw( name, command, pattern = NULL, packages = targets::tar_option_get("packages"), library = targets::tar_option_get("library"), deps = NULL, string = NULL, format = targets::tar_option_get("format"), iteration = targets::tar_option_get("iteration"), error = targets::tar_option_get("error"), memory = targets::tar_option_get("memory"), garbage_collection = targets::tar_option_get("garbage_collection"), deployment = targets::tar_option_get("deployment"), priority = targets::tar_option_get("priority"), resources = targets::tar_option_get("resources"), storage = targets::tar_option_get("storage"), retrieval = targets::tar_option_get("retrieval"), cue = targets::tar_option_get("cue") )
name |
Character of length 1, name of the target. A target
name must be a valid name for a symbol in R, and it
must not start with a dot. Subsequent targets
can refer to this name symbolically to induce a dependency relationship:
e.g. |
command |
Similar to the |
pattern |
Similar to the |
packages |
Character vector of packages to load right before
the target builds. Use |
library |
Character vector of library paths to try
when loading |
deps |
Optional character vector of the adjacent upstream
dependencies of the target, including targets and global objects.
If |
string |
Optional string representation of the command.
Internally, the string gets hashed to check if the command changed
since last run, which helps |
format |
Optional storage format for the target's return value.
With the exception of |
iteration |
Character of length 1, name of the iteration mode of the target. Choices:
|
error |
Character of length 1, what to do if the target stops and throws an error. Options:
|
memory |
Character of length 1, memory strategy.
If |
garbage_collection |
Logical, whether to run |
deployment |
Character of length 1, only relevant to
|
priority |
Numeric of length 1 between 0 and 1. Controls which
targets get deployed first when multiple competing targets are ready
simultaneously. Targets with priorities closer to 1 get built earlier
(and polled earlier in |
resources |
Object returned by |
storage |
Character of length 1, only relevant to
|
retrieval |
Character of length 1, only relevant to
|
cue |
An optional object from |
A target object. Users should not modify these directly,
just feed them to list()
in your target script file
(default: _targets.R
).
See the "Target objects" section for details.
Functions like tar_target()
produce target objects,
special objects with specialized sets of S3 classes.
Target objects represent skippable steps of the analysis pipeline
as described at https://books.ropensci.org/targets/.
Please read the walkthrough at
https://books.ropensci.org/targets/walkthrough.html
to understand the role of target objects in analysis pipelines.
For developers, https://wlandau.github.io/targetopia/contributing.html#target-factories explains target factories (functions like this one which generate targets) and the design specification at https://books.ropensci.org/targets-design/ details the structure and composition of target objects.
Other targets:
tar_cue()
,
tar_format()
,
tar_target()
# The following are equivalent. y <- tar_target(y, sqrt(x), pattern = map(x)) y <- tar_target_raw("y", expression(sqrt(x)), expression(map(x))) # Programmatically create a chain of interdependent targets target_list <- lapply(seq_len(4), function(i) { tar_target_raw( letters[i + 1], substitute(do_something(x), env = list(x = as.symbol(letters[i]))) ) }) print(target_list[[1]]) print(target_list[[2]]) if (identical(Sys.getenv("TAR_EXAMPLES"), "true")) { tar_dir({ # tar_dir() runs code from a temporary directory. tar_script(tar_target_raw("x", quote(1 + 1)), ask = FALSE) tar_make() tar_read(x) }) }
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.