| id_chr {drake} | R Documentation |
Name of the current target ![[Stable]](../help/figures/lifecycle-stable.svg)
Description
id_chr() gives you the name of the current target
while make() is running. For static branching in drake_plan(),
use the .id_chr symbol instead. See the examples for details.
Usage
id_chr()
Value
The name of the current target.
Keywords
drake_plan() understands special keyword functions for your commands.
With the exception of target(), each one is a proper function
with its own help file.
-
target(): give the target more than just a command. Usingtarget(), you can apply a transformation (examples:https://books.ropensci.org/drake/plans.html#large-plans), # nolint supply a trigger (https://books.ropensci.org/drake/triggers.html), # nolint or set any number of custom columns. -
file_in(): declare an input file dependency. -
file_out(): declare an output file to be produced when the target is built. -
knitr_in(): declare aknitrfile dependency such as an R Markdown (*.Rmd) or R LaTeX (*.Rnw) file. -
ignore(): forcedraketo entirely ignore a piece of code: do not track it for changes and do not analyze it for dependencies. -
no_deps(): telldraketo not track the dependencies of a piece of code.drakestill tracks the code itself for changes. -
id_chr(): Get the name of the current target. -
drake_envir(): get the environment where drake builds targets. Intended for advanced custom memory management.
Examples
try(id_chr()) # Do not use outside the plan.
## Not run:
isolate_example("id_chr()", {
plan <- drake_plan(x = id_chr())
make(plan)
readd(x)
# Dynamic branching
plan <- drake_plan(
x = seq_len(4),
y = target(id_chr(), dynamic = map(x))
)
make(plan)
readd(y, subtargets = 1)
# Static branching
plan <- drake_plan(
y = target(c(x, .id_chr), transform = map(x = !!seq_len(4)))
)
plan
})
## End(Not run)