Skip to contents

Flow is an R6 class used for initializing, constructing and modifying the information that goes into the flowchart. The plotting is then handled via the plot() function.

Usage

# S3 method for class 'Flow'
plot(x, xm = 0.1, ym = 0.1, hpad = 10, vpad = 10, ...)

Arguments

x

Flow object

xm, ym

Outer x/y margins of the plot (.2 = 20% margin on each side); default: 0.1

hpad, vpad

Horzontal/verticl padding around text in chart nodes, in mm; default: 10

...

For S3 method compatibility

Active bindings

n

Number of nodes

Parent

Vector of parent nodes

x

Vector of horizontal positions

Label

Vector of labels

Methods


Method new()

Initialize a new flowchart at its parent node

Usage

Flow$new(lab, x = 0)

Arguments

lab

Label (node text)

x

Horizontal position (0=center)


Method print()

Print the current status of the flowchart

Usage

Flow$print()


Method add()

Add a node to the flowchart

Usage

Flow$add(lab, parent, x = 0)

Arguments

lab

Label (node text)

parent

Number (i.e., row) of this node's parent

x

Horizontal position (0=center)


Method clone()

The objects of this class are cloneable with this method.

Usage

Flow$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

fl <- Flow$new("All children\n(n=935)")
fl$add("Returned form\n(n=511)", parent=1)
fl$add("Baseline: 0\n(n=447)", parent=2, x=-1)
fl$add("Baseline: 1 or 2\n(n=14)", parent=2)
fl$add("Baseline: 3\n(n=50)", parent=2, x=1)
fl$add("Initiation\n(n=315)", parent=3, x=-1)
fl$add("Completion\n(n=276)", parent=6, x=-1)
fl$add("Completion\n(n=12)", parent=4)
fl
#>                      Label Parent  x
#> 1    All children\n(n=935)      0  0
#> 2   Returned form\n(n=511)      1  0
#> 3     Baseline: 0\n(n=447)      2 -1
#> 4 Baseline: 1 or 2\n(n=14)      2  0
#> 5      Baseline: 3\n(n=50)      2  1
#> 6      Initiation\n(n=315)      3 -1
#> 7      Completion\n(n=276)      6 -1
#> 8       Completion\n(n=12)      4  0
#> Class: Flow
plot(fl)

plot(fl, hpad=20, vpad=20)

plot(fl, xm=0.25)