sankeymatic: Create Sankey charts with sankeymatic.com

Description Usage Arguments Value Examples

Description

This function produces a data.frame of text that can be pasted into sankeymatic.com for the creation of sankey charts. It is essentially an unsatisfactory stop gap until some nice way of producing sankey charts in ggplot2 is introduced.

Usage

1
sankeymatic(df, left, right)

Arguments

df

A data frame from which to creat the sankey chart.

left

A variable from the data frame that will feature on the left hand side of the sankey chart.

right

A variable from the data frame that will feature on the right hand side of the sankey chart.

Value

A data.frame with one column, 'sankeymatic', of nodes and counts in the format required by sankeymatic.com.

A data.frame is produced rather than a tibble as the print method allows row.names and right align to be suppressed. Text can then be copied directly from the console.

Examples

1
2
3
library(ggplot2)
sankeymatic(diamonds, cut, color)
sankeymatic(diamonds, cut, color) %>%  print(right = FALSE, row.names = FALSE)

leebunce/leebunce documentation built on May 20, 2019, 4:06 p.m.