Learn R Programming

drake (version 4.2.0)

dataframes_graph: Function dataframes_graph

Description

Get the information about nodes, edges, and the legend/key so you can plot your own custom visNetwork.

Usage

dataframes_graph(plan, targets = drake::possible_targets(plan),
  envir = parent.frame(), verbose = TRUE, cache = NULL, jobs = 1,
  parallelism = drake::default_parallelism(), packages = (.packages()),
  prework = character(0), build_times = TRUE, digits = 0,
  targets_only = FALSE, split_columns = FALSE, font_size = 20,
  config = NULL)

Arguments

plan

workflow plan data frame, same as for function make().

targets

names of targets to bulid, same as for function make().

envir

environment to import from, same as for function make(). config$envir is ignored in favor of envir.

verbose

logical, whether to output messages to the console.

cache

optional drake cache. Only used if the config argument is NULL (default). See codenew_cache().

jobs

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.

parallelism

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.

packages

same as for make

prework

same as for make

build_times

logical, whether to show the build_times() of the targets and imports, if available. These are just elapsed times from system.time().

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

config

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().

Value

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.

See Also

plot_graph, build_graph

Examples

Run this code
# NOT RUN {
load_basic_example()
raw_graph <- dataframes_graph(my_plan)
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