Skip to contents

Create a 'networkD3' style sankey chart based on a long count table with two variables. The input data should have three columns, where each row is a unique group:

  1. Variable 1

  2. Variable 2

  3. Count

Usage

create_sankey(data, var1, var2, count = "n")

Arguments

data

Data frame of the long count table.

var1

String containing the name of the variable to be shown on the left.

var2

String containing the name of the variable to be shown on the right.

count

String containing the name of the count variable.

Value

A 'sankeyNetwork' and 'htmlwidget' object containing a two-tier sankey plot. The output can be saved locally with htmlwidgets::saveWidget().

Examples

# \donttest{
pq_data %>%
  dplyr::count(Organization, FunctionType) %>%
  create_sankey(var1 = "Organization", var2 = "FunctionType")
# }