Skip to contents

Create nodes for a step-package Sankey diagram

Usage

make_nodes(x)

Arguments

x

A data frame containing at least a package column where each entry describes the package combination at a given step.

Value

A data frame with columns name, node_name, and id suitable for use with networkD3::sankeyNetwork().

Examples

df <- simulate(3)
make_nodes(df)
#>                    name             node_name id     p
#> 1                    cm                    cm  0  100%
#> 2               cm, itn               cm\nitn  1  100%
#> 3          cm, itn, irs          cm\nitn\nirs  2 33.3%
#> 4          cm, itn, smc          cm\nitn\nsmc  3 66.7%
#> 5     cm, itn, smc, irs     cm\nitn\nsmc\nirs  4 66.7%
#> 6      cm, itn, smc, vx      cm\nitn\nsmc\nvx  5 33.3%
#> 7 cm, itn, smc, vx, irs cm\nitn\nsmc\nvx\nirs  6  100%