Skip to contents

Generate a flowchart of the history of the dataframe(s), with all the tracked data pipeline as stages in the flowchart. Multiple dataframes can be plotted together in which case an attempt is made to determine which parts are common.

Usage

flowchart(
  .data,
  filename = NULL,
  size = std_size$full,
  maxWidth = size$width,
  maxHeight = size$height,
  formats = c("dot", "png", "pdf", "svg"),
  defaultToHTML = TRUE,
  landscape = size$rot != 0,
  ...
)

Arguments

.data

the tracked dataframe(s) either as a single dataframe or as a list of dataframes.

filename

a file name which will be where the formatted flowcharts are saved. If no extension is specified the output formats are determined by the formats parameter.

size

a named list with 3 elements, length and width in inches and rotation. A predefined set of standard sizes are available in the std_size object.

maxWidth

a width (on the paper) in inches if size is not defined

maxHeight

a height (on the paper) in inches if size is not defined

formats

some of pdf,dot,svg,png,ps

defaultToHTML

if the correct output format is not easy to determine from the context, default providing HTML (TRUE) or to embedding the PNG (FALSE)

landscape

rotate the output by 270 degrees into a landscape format. maxWidth and maxHeight still apply and refer to the paper width to fit the flowchart into after rotation. (you might need to flip width and height)

...

other parameters passed onto either p_get_as_dot(), notable ones are fill (background colour e.g. lightgrey), fontsize (in points), colour (font colour)

Value

the nature of the flowchart output depends on the context in which the function is called. It will be some form of browse-able html output if called from an interactive session or a PNG/PDF link if in knitr and knitting latex or word type outputs, if file name is specified the output will also be saved at the given location.

Examples

library(dplyr)
library(dtrackr)

tmp = iris %>% track() %>% comment(.tag = "step1") %>% filter(Species!="versicolor")
tmp %>% group_by(Species) %>% comment(.tag="step2") %>% flowchart()