Achieve a initialized CrossLink object by providing nodes, edges and cross.by.

crosslink(
  nodes,
  edges,
  cross.by,
  gaps = NULL,
  spaces = c("equal", "partition", "flank"),
  xrange = NULL,
  yrange = NULL,
  key.by = 1,
  src.by = 1,
  tar.by = 2,
  odd.rm = FALSE
)

Arguments

nodes

a data frame with unique keys in the 1st (settable by key.by) column and metadata (used for aesthetic of nodes) in the other columns

edges

a data frame with source and target nodes in the first two (settable by src.by and tar.by) columns and other metadata.

cross.by

the name of a column in nodes, by which nodes will be grouped into different crosses. To control the order of crosses and the order of nodes, set factor levels for the corresponding column in nodes. see factor or forcats::fct_relevel()

gaps

a numeric vector of n-1 length, n is the number of crosses (that is length(object@cross)). It's a vector of gaps between adjacent crosses. set NA or NULL to use equally divided gaps.

spaces

set "equal" for equidistant globally in all crosses, set "partition" for equidistant separately in each cross, or set "flank", which is similar to "partition" but with top/bottom flank anchors included. Default: equal.

xrange, yrange

range of x and y. set NULL or NA to ignore this.

key.by

name or index of the column in nodes to be used as key of nodes

src.by

name or index of the column in edges to be used as source of links (edges)

tar.by

name or index of the column in edges to be used as target of links (edges)

odd.rm

remove odd nodes that are not included in edges (without links).

Value

a CrossLink object

Examples