Skip to contents

(advance usage) outputs a dtrackr history graph as a DOT string for rendering with Graphviz

Usage

p_get_as_dot(.data, fill = "lightgrey", fontsize = "8", colour = "black", ...)

Arguments

.data

the tracked dataframe

fill

the default node fill colour

fontsize

the default font size

colour

the default font colour

...

not used

Value

a representation of the history graph in Graphviz dot format.

Examples

library(dplyr)
library(dtrackr)

tmp = iris %>% track() %>% comment(.tag = "step1") %>% filter(Species!="versicolor")
dot = tmp %>% group_by(Species) %>% comment(.tag="step2") %>% p_get_as_dot()
cat(dot)
#> digraph {
#>      graph [layout = 'dot',
#>         splines='ortho',
#>         rankdir = 'TB',
#>         outputorder = 'edgesfirst',
#>         bgcolor = 'white',
#>         ranksep = '0.25',
#>         nodesep = '0.2',
#>         newrank='true']
#> 
#>     node [fontname = 'Helvetica',
#>         fontsize = '8',
#>         shape='box',
#>         fixedsize = 'false',
#>         margin = '0.1,0.1',
#>         width = '0',
#>         height = '0',
#>         style = 'filled',
#>         color = 'black',
#>         fontcolor = 'black',
#>         labeljust='l']
#> 
#>     edge [fontname = 'Helvetica',
#>         fontsize = '8',
#>         len = '0.5',
#>         color = 'black',
#>         arrowsize = '0.5']
#>     
#> { rank='same';
#> '5' [label=<<B>Species:setosa</B><BR ALIGN='LEFT'/>50 items<BR ALIGN='LEFT'/>>,group='Species:setosa',fillcolor='white'];
#> '6' [label=<<B>Species:virginica</B><BR ALIGN='LEFT'/>50 items<BR ALIGN='LEFT'/>>,group='Species:virginica',fillcolor='white'];
#> }
#> { rank='same';
#> '4' [label=<stratify by Species<BR ALIGN='LEFT'/>>,group='',fillcolor='white'];
#> }
#> { rank='same';
#> '2' [label=<150 items<BR ALIGN='LEFT'/>>,group='',fillcolor='white'];
#> '3' [label=<excluded 50 items<BR ALIGN='LEFT'/>>,group='',fillcolor='grey80'];
#> }
#> { rank='same';
#> '1' [label=<150 items<BR ALIGN='LEFT'/>>,group='',fillcolor='white'];
#> }
#> 
#> 
#> '4' -> '6' [tailport='s',weight='100']
#> '4' -> '5' [tailport='s',weight='100']
#> '2' -> '4' [tailport='s',weight='100']
#> '2' -> '3' [tailport='e',weight='1']
#> '1' -> '2' [tailport='s',weight='100']
#> }