# NOT RUN {
test_with_dir("Quarantine side effects.", {
load_mtcars_example() # Get the code with drake_example("mtcars").
config <- drake_config(my_plan) # my_plan loaded with load_mtcars_example()
vis_drake_graph(config) # Jump straight to the interactive graph.
# Get a list of data frames representing the nodes, edges,
# and legend nodes of the visNetwork graph from vis_drake_graph().
raw_graph <- drake_graph_info(config = config)
# Choose a subset of the graph.
smaller_raw_graph <- drake_graph_info(
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')
# Optionally visualize clusters.
config$plan$large_data <- grepl("large", config$plan$target)
graph <- drake_graph_info(
config, group = "large_data", clusters = c(TRUE, FALSE))
tail(graph$nodes)
render_drake_graph(graph)
# You can even use clusters given to you for free in the `graph$nodes`
# data frame.
graph <- drake_graph_info(
config, group = "status", clusters = "imported")
tail(graph$nodes)
render_drake_graph(graph)
})
# }
Run the code above in your browser using DataLab