View source: R/sankeydiagram.R
SankeyDiagram | R Documentation |
Creates a sankey diagram of the relationship between different variables.
SankeyDiagram(
data = NULL,
links.and.nodes = NULL,
output.data.only = FALSE,
max.categories = 8,
subset = NULL,
weights = NULL,
font.size = 12,
font.family = "Times New Roman",
font.unit = "px",
colors = NULL,
link.color = c("None", "Source", "Target", "First variable", "Last variable")[1],
variables.share.values = FALSE,
label.show.varname = TRUE,
label.max.length = 100,
label.show.counts = FALSE,
label.show.percentages = FALSE,
node.position.automatic = TRUE,
node.width = 30,
node.padding = 10,
sinks.right = TRUE,
hovertext.show.percentages = FALSE
)
data |
A |
links.and.nodes |
Input a list structure from a previous call of SankeyDiagram
with |
output.data.only |
Only outputs the link and node structure without printing the sankey diagram. |
max.categories |
When the number of unique values of numeric data exceeds this value, the variable is quantized. |
subset |
An optional vector specifying a subset of observations to be used in the fitting process. |
weights |
An optional vector of weights. If not provided, the width of the links is proportional to the number of rows in the data frame that correspond to the path (flow). |
font.size |
Font size of node labels. |
font.family |
Font family of node labels. |
font.unit |
One of "px" of "pt". By default all font sizes are specified in terms of pixels ("px"). But changing this to "pt" will mean that the font sizes will be in terms points ("pt"), which will be consistent with font sizes in text boxes. |
colors |
Colors of the nodes, supplied as a vector of hex colors. |
link.color |
One of |
variables.share.values |
If |
label.show.varname |
Show variable name in node label. |
label.max.length |
Maximum number of characters in each node label. |
label.show.counts |
Append count data to node labels. |
label.show.percentages |
Append percentages to node labels. |
node.position.automatic |
Position nodes automatically to reduce the number of overlapping links. This is turned on by default, and when turned off the nodes will be positioned in order they are given in the data. |
node.width |
Width of the width. |
node.padding |
Vertical space between nodes. |
sinks.right |
Logical indicating whether to move the last nodes to the right border of the plot. |
hovertext.show.percentages |
Show percentages instead of counts in the hovertext. |
Text variables are grouped as having text or not having text. To see patterns with text variables, they should first be turned into factors.
A sankey diagram (HTMLwidget).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.