alluvial_diagram {visachartR} | R Documentation |
alluvial_diagram
Description
R wrapper for @visa/alluvial-diagram via htmlwidgets.
Here is an example of alluvial-diagram in action:
Usage
alluvial_diagram(
linkData,
nodeData = NULL,
sourceAccessor,
targetAccessor,
valueAccessor,
nodeIDAccessor = "",
groupAccessor = "",
mainTitle = "",
subTitle = "",
accessibility = list(),
props = list(),
...
)
Arguments
linkData |
required to be a valid, R data frame. Data used to create links in diagram, an array of objects which includes keys that map to chart accessors. See d3-sankey for additional detail on data requirements. |
nodeData |
required to be a valid, R data frame. Optional. Data used to create nodes in diagram, an array of objects which includes key that map to chart accessors. See d3-sankey for additional detail on data requirements. |
sourceAccessor |
String. Key used to determine link's source, must be a node. |
targetAccessor |
String. Key used to determine link's target, must be a node. |
valueAccessor |
String. Key used to determine link (and ultimately node size). |
nodeIDAccessor |
String. Key used to determine unique node identifiers. Requires nodeData to be populated. |
groupAccessor |
String. Key used to determine link's group or category. |
mainTitle |
String. The dynamic tag of title for the map (or you can create your own separately). See |
subTitle |
String. The dynamic tag for a sub title for the map (or you can create your own separately). See |
accessibility |
List(). Manages messages and settings for chart accessibility, see object definition |
props |
List(). A valid R list with additional property configurations, see all props for @visa/alluvial-diagram |
... |
All other props passed into the function will be passed through to the chart, see all props for @visa/alluvial-diagram. |
Details
To see all available options for the chart properties/API see @visa/alluvial-diagram.
Value
a visaNodeLinkChart htmlwidget object for plotting an alluvial diagram
Examples
library(dplyr)
data.frame(HairEyeColor) %>%
filter(Sex=="Female") %>%
mutate(newHair = paste(Hair,"-Hair")) %>%
mutate(newEye = paste(Eye,"-Eye")) %>%
alluvial_diagram(sourceAccessor = "newHair", targetAccessor = "newEye", valueAccessor = "Freq")