vis_drake_graph()
.R/dataframes_graph.R
With the returned data frames,
you can plot your own custom visNetwork
graph.
dataframes_graph(config = drake::read_drake_config(), from = NULL, mode = c("out", "in", "all"), order = NULL, subset = NULL, build_times = "build", digits = 3, targets_only = FALSE, split_columns = FALSE, font_size = 20, from_scratch = FALSE, make_imports = TRUE, full_legend = TRUE)
config | a |
---|---|
from | Optional collection of target/import names.
If |
mode | Which direction to branch out in the graph
to create a neighborhood around |
order | How far to branch out to create
a neighborhood around |
subset | Optional character vector of of target/import names.
Subset of nodes to display in the graph.
Applied after |
build_times | character string or logical.
If character, the choices are
1. |
digits | number of digits for rounding the build times |
targets_only | logical, whether to skip the imports and only include the targets in the workflow plan. |
split_columns | 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.) |
font_size | numeric, font size of the node labels in the graph |
from_scratch | logical, whether to assume all the targets
will be made from scratch on the next |
make_imports | logical, whether to make the imports first.
Set to |
full_legend | logical. If |
A list of three data frames: one for nodes, one for edges, and one for the legend nodes. The list also contains the default title of the graph.
vis_drake_graph()
, build_drake_graph()
# NOT RUN { test_with_dir("Quarantine side effects.", { config <- load_basic_example() # Get the code with drake_example("basic"). # Get a list of data frames representing the nodes, edges, # and legend nodes of the visNetwork graph from vis_drake_graph(). raw_graph <- dataframes_graph(config = config) # Choose a subset of the graph. smaller_raw_graph <- dataframes_graph( config = config, from = c("small", "reg2"), mode = "in" ) # Inspect the raw graph. str(raw_graph) # Use the data frames to plot your own custom visNetwork graph. # For example, you can omit the legend nodes # and change the direction of the graph. library(magrittr) library(visNetwork) visNetwork(nodes = raw_graph$nodes, edges = raw_graph$edges) %>% visHierarchicalLayout(direction = 'UD') }) # }