| ba_layout | R Documentation |
Returns tidy node coordinates and the edge table needed to render a bass-ackwards diagram. The layout uses a two-pass barycenter algorithm:
ba_layout(x, min_sep = 1)
x |
An |
min_sep |
Minimum horizontal separation between adjacent nodes at the
same level. Default |
Top-down pass – determines the left-to-right order of factors at each level. Each factor's ordinal rank is the |r|-weighted mean of its parents' ranks in the level above, so siblings that share a parent are grouped together.
Bottom-up pass – assigns actual x coordinates. The deepest level (level k) is spread evenly; every upper-level factor is placed at the simple mean x of its primary children: a factor with one primary child lands directly above it; a factor with two primary children lands exactly halfway between them. Falls back to |r|-weighted mean of all children for factors with no primary children. Spreading resolves any remaining overlaps.
After both passes the layout is shifted so that the single level-1 node is always at x = 0.
A list with two data frames:
nodes |
One row per factor: |
edges |
The tidy edge table from |
autoplot.ackwards(), tidy.ackwards()
x <- ackwards(sim16, k_max = 5)
lay <- ba_layout(x)
head(lay$nodes)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.