Learn R Programming

flow (version 0.0.1)

flow_data: View function as flow chart

Description

flow_view() shows the code of a function as a flow diagram, flow_run() runs a call and draws the logical path taken by the code, flow_data() is the lower level function, which builds the edge and node data rendered by flow_view() and flow_run().

Usage

flow_data(
  x,
  range = NULL,
  prefix = NULL,
  sub_fun_id = NULL,
  swap = TRUE,
  narrow = FALSE
)

flow_view( x, range = NULL, prefix = NULL, sub_fun_id = NULL, swap = TRUE, narrow = FALSE, code = TRUE, width = NULL, height = NULL, ..., out = NULL, svg = FALSE, engine = c("nomnoml", "plantuml") )

flow_run( x, prefix = NULL, swap = TRUE, code = TRUE, ..., out = NULL, svg = FALSE, browse = FALSE, show_passes = FALSE )

Arguments

x

A call, a function, or a path to a script

range

numeric vector used to compute the range of boxes to zoom in

prefix

prefix to use for special comments in our code used as block headers, must start with "#"

sub_fun_id

if not NULL, the index or name of the function definition found in x that we wish to inspect

swap

whether to change var <- if(cond) expr into if(cond) var <- expr so the diagram displays better

narrow

TRUE makes sure the diagram stays centered on one column (they'll be longer but won't shift to the right)

code

Whether to display the code in code blocks or only the header, to be more compact, if NA, the code will be displayed only if no header is defined by special comments.

width, height

Width and height in pixels, passed to htmlwidgets::createWidget()

...

Additional parameters passed to build_nomnoml_code()

out

a path to save the diagram to. Special values "html", "htm", "png", "pdf", "jpg" and "jpeg" can be used to export the objec to a temp file of the relevant format and open it, if a regular path is used the format will be guessed from the extension.

svg

only for default or html outut, whether to use svg rendering, rendering is more robust without it, but it makes text selectable on output which is sometimes useful

engine

Either "nomnoml" (default) or "plantuml" (experimental), if the latter, arguments range, prefix, narrow, code, width, height and ... will be ignored.

browse

whether to debug step by step (block by block), can also be a vector of block ids, in this case browser() calls will be inserted at the start of these blocks

show_passes

label the edges with the number of passes