tar_name: Get the name of the target currently running.

Description Usage Arguments Value See Also Examples

View source: R/tar_name.R

Description

Get the name of the target currently running.

Usage

1
tar_name(default = "target")

Arguments

default

Character, value to return if tar_name() is called on its own outside a targets pipeline. Having a default lets users run things without tar_make(), which helps peel back layers of code and troubleshoot bugs.

Value

Character of length 1. If called inside a pipeline, tar_name() returns name of the target currently running. Otherwise, the return value is default.

See Also

Other utilities: tar_cancel(), tar_envir(), tar_group(), tar_path(), tar_seed()

Examples

1
2
3
4
5
6
7
8
9
tar_name()
tar_name(default = "custom_target_name")
if (identical(Sys.getenv("TAR_EXAMPLES"), "true")) {
tar_dir({ # tar_dir() runs code from a temporary directory.
tar_script(tar_target(x, tar_name()), ask = FALSE)
tar_make()
tar_read(x)
})
}

targets documentation built on July 21, 2021, 5:07 p.m.