rt_plot_sankey: creates a sankey diagram based on a data-frame containing...

rt_plot_sankeyR Documentation

creates a sankey diagram based on a data-frame containing touch-points in the form of

Description

entity_id | touch_category | touch_index | weight (optional) ============================================================ personA | Home Page | 1 0 personA | Pricing Page | 2 0 personA | Conversion | 3 0 personB | Home Page | 1 2 personB | Bounced | 2 2 personC | Pricing | 1 1

Usage

rt_plot_sankey(
  .path_data,
  .id = "entity_id",
  .path_column = "touch_category",
  .visit_index = "touch_index",
  .weight = NULL,
  .valid_final_touch_points = NULL,
  .ensure_complete_funnel = TRUE,
  .bounced_fill_value = "Bounced",
  .no_prior_data = "<No Prior Touch-Point>",
  .global_path_values = NULL,
  .depth_threshold = NULL,
  .show_percentages = FALSE,
  .order_by = c("size", "optimize", "both"),
  .connection_threshold = 200
)

Arguments

.path_data

data-frame of touch-points

.id

entity id column

.path_column

column of the path or touch-points

.visit_index

numeric index touch-points

.weight

column that gives a weight value, which should be the same for each touch-point for a given entity_id (basically the value of the entity)

.valid_final_touch_points

specify what is considered the ending events.

.ensure_complete_funnel

If TRUE, this makes sure that the number of people/entities in the first level of the sankey plot equals the number of people/entities in the final level of the plot Any path where the last touch-point is not one of the values in '.valid_final_touch_points' is considered a "bounce" and an additional touch-point will be added. The value of the new touch-point will be based on '.bounced_fill_value' Any path that only 1 touch-point and the value is in '.valid_final_touch_points' will have an additional touch-point added of "<No Prior Touch-Point>"

.bounced_fill_value

the value to be inserted as a touch-point when an entity bounces (does not have a conversion touch-point)

.no_prior_data

the value to be inserted as a touch-point when an entity only has a conversion touch-point

.global_path_values

a list of all possible touch-categories, which the colors will be based on. This ensures that the colors of graphs are consistent across multiple graphs even if the same categories don't show up in each graph

.depth_threshold

the number of leves at the beginning and end of the journey/path

.show_percentages

if TRUE, then show percentage in parentheses for each node which corresponds to percentage of all ids or percentage of all weights depending on if .weight field is populated

.order_by

determines the arrangement of the diagram; 'both' returns a list of 2 items, each containing a plot

.connection_threshold

used to limit the number of connections: too many and the function call to generate the diagram will just hang

Details

where the column names are specified as parameters.


shane-kercheval/rtools documentation built on July 7, 2022, 8:31 a.m.