For developers only: get the definition of the current target.
Source:R/tar_definition.R
tar_definition.Rd
For developers only: get the full definition of the
target currently running. This target definition is the same kind
of object produced by tar_target()
.
Usage
tar_definition(
default = targets::tar_target_raw("target_name", quote(identity()))
)
Arguments
- default
Environment, value to return if
tar_definition()
is called on its own outside atargets
pipeline. Having a default lets users run things withouttar_make()
, which helps peel back layers of code and troubleshoot bugs.
Value
If called from a running target, tar_definition()
returns
the target object of the currently running target.
See the "Target objects" section for details.
Details
Most users should not use tar_definition()
because accidental
modifications could break the pipeline.
tar_definition()
only exists in order to support third-party interface
packages, and even then the returned target definition is not modified..
Target objects
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.
See also
Other utilities:
tar_active()
,
tar_backoff()
,
tar_call()
,
tar_cancel()
,
tar_described_as()
,
tar_envir()
,
tar_format_get()
,
tar_group()
,
tar_name()
,
tar_path()
,
tar_path_script()
,
tar_path_script_support()
,
tar_path_store()
,
tar_path_target()
,
tar_source()
,
tar_store()
,
tar_unblock_process()
Examples
class(tar_definition())
#> [1] "tar_stem" "tar_builder" "tar_target" "environment"
tar_definition()$name
#> [1] "target_name"
if (identical(Sys.getenv("TAR_EXAMPLES"), "true")) { # for CRAN
tar_dir({ # tar_dir() runs code from a temp dir for CRAN.
tar_script(
tar_target(x, tar_definition()$settings$memory, memory = "transient")
)
tar_make(x)
tar_read(x)
})
}