View source: R/drake_plan_helpers.R
id_chr | R Documentation |
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.
id_chr()
The name of the current target.
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.
Using target()
, 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 a knitr
file dependency such as an
R Markdown (*.Rmd
) or R LaTeX (*.Rnw
) file.
ignore()
: force drake
to entirely ignore a piece of code:
do not track it for changes and do not analyze it for dependencies.
no_deps()
: tell drake
to not track the dependencies
of a piece of code. drake
still 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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.