makeSankey: makeSankey

Description Usage Arguments Value Examples

View source: R/functions.R

Description

Takes a list of source-target pairs and assigns colours to nodes and connections based on value, sourcefc and targetfc. Output is a list with List$reference = input List with additional description values, $valDomain = path values, $valRange = path colours, $targetDomain = target names, $targetRange = target node colours, $sourceDomain = source names, $sourceRange = source node colours.

Usage

1
2
3
makeSankey(List, averagePath = FALSE, nodeMin = "blue", nodeMax = "red",
  pathMin = "blue", pathMax = "red", noughtColor = "#f5f5f0",
  nought = 0, noughtPath = NULL, noughtPathColor = NULL)

Arguments

List

Data frame containing 6 columns: source, target, description, value, sourcefc, targetfc.

averagePath

Boolean to either keep List$value as-is, or calculate List$value for intermediary nodes (i.e. source nodes that were previously target nodes) as an average of previous path List$values.

nodeMin

Colour assigned to minimum node value.

nodeMax

Colour assigned to maximum node value.

pathMin

Colour assigned to minimum path value.

pathMax

Colour assigned to maximum path value.

noughtColor

Colour assigned to nought value.

nought

'Zero' value dividing node and paths into two distinct sets. i.e. positive and negative.

noughtPath

Optional parameter that sets a different 'zero' value for paths than for nodes.

noughtPathColor

Optional parameter that assigns a different colour to the path 'zero' value from the node 'zero' value.

Value

a list of data.frames and colour vectors.

Examples

1
2
3
4
5
6
7
8
tempList <- createList(data.frame(source=c("A","B","C"),
    target=c("D","E","G"),
    description=c("consonant","vowel","consonant"),
    value=runif(3,-1,1),
    sourcefc=runif(3,-2,2),
    targetfc=runif(3,-2,2)))
initSankey()
tempList2 <- makeSankey(tempList)

Director documentation built on Nov. 8, 2020, 5:55 p.m.