dataframes_graph
Get the information about nodes, edges, and the legend/key
so you can plot your own custom visNetwork
.
dataframes_graph(plan = workplan(), targets = drake::possible_targets(plan),
envir = parent.frame(), verbose = TRUE, hook = function(code) {
force(code) }, cache = drake::get_cache(verbose = verbose), jobs = 1,
parallelism = drake::default_parallelism(), packages = rev(.packages()),
prework = character(0), build_times = TRUE, digits = 3,
targets_only = FALSE, split_columns = FALSE, font_size = 20,
config = NULL, from = NULL, mode = c("out", "in", "all"),
order = NULL, subset = NULL, from_scratch = FALSE)
workflow plan data frame, same as for function
make()
.
names of targets to build, same as for function
make()
.
environment to import from, same as for function
make()
. config$envir
is ignored in favor
of envir
.
logical, whether to output messages to the console.
same as for make
optional drake cache. Only used if the config
argument is NULL
(default). See codenew_cache().
The outdated()
function is called internally,
and it needs to import objects and examine your
input files to see what has been updated. This could take some time,
and parallel computing may be needed
to speed up the process. The jobs
argument is number of parallel jobs
to use for faster computation.
Choice of parallel backend to speed up the computation.
Execution order in make()
is slightly different when
parallelism
equals 'Makefile'
because in that case, all the imports are imported
before any target is built.
Thus, the arrangement in the graph is different for Makefile parallelism.
See ?parallelism_choices
for details.
same as for make
same as for make
logical, whether to show the build_times()
of the targets and imports, if available.
These are just elapsed times from system.time()
.
number of digits for rounding the build times
logical, whether to skip the imports and only include the targets in the workflow plan.
logical, whether to break up the columns of nodes to make the aspect ratio of the rendered graph closer to 1:1. This improves the viewing experience, but the columns no longer strictly represent parallelizable stages of build items. (Although the targets/imports in each column are still conditionally independent, there may be more conditional independence than the graph indicates.)
numeric, font size of the node labels in the graph
option internal runtime parameter list of
make(...)
,
produced with config()
.
config$envir
is ignored.
Otherwise, computing this
in advance could save time if you plan multiple calls to
dataframes_graph()
.
If not NULL
,
config
overrides all arguments except
build_times
, digits
, targets_only
,
split_columns
, and font_size
.
Optional collection of target/import names.
If from
is nonempty,
the graph will restrict itself to
a neighborhood of from
.
Control the neighborhood with
mode
and order
.
Which direction to branch out in the graph
to create a neighborhood around from
.
Use "in"
to go upstream,
"out"
to go downstream,
and "all"
to go both ways and disregard
edge direction altogether.
How far to branch out to create
a neighborhood around from
(measured
in the number of nodes). Defaults to
as far as possible.
Optional character vector of of target/import names.
Subset of nodes to display in the graph.
Applied after from
, mode
, and order
.
Be advised: edges are only kept for adjacent nodes in subset
.
If you do not select all the intermediate nodes,
edges will drop from the graph.
logical, whether to assume that
all targets are out of date and the next make()
will happen from scratch. Setting to TRUE
will prevent
the graph from showing you which targets are up to date,
but it makes computing the graph much faster.
a list of three data frames: one for nodes, one for edges, and one for the legend/key nodes. The list also contains the default title of the graph.
# NOT RUN {
load_basic_example()
raw_graph <- dataframes_graph(my_plan)
smaller_raw_graph <- dataframes_graph(
my_plan,
from = c("small", "reg2"),
to = "summ_regression2_small"
)
str(raw_graph)
# Plot your own custom visNetwork graph
library(magrittr)
library(visNetwork)
visNetwork(nodes = raw_graph$nodes, edges = raw_graph$edges) %>%
visLegend(useGroups = FALSE, addNodes = raw_graph$legend_nodes) %>%
visHierarchicalLayout(direction = 'LR')
# }
Run the code above in your browser using DataLab