rt_explore_plot_conversion_rates: shows conversion rates (y-axis) of a particular cohort based...

View source: R/explore_basics.R

rt_explore_plot_conversion_ratesR Documentation

shows conversion rates (y-axis) of a particular cohort based on various 'snapshots' in time (a line is a snapshot in time).

Description

Assumes each record is an individual entity. Meaning, for example, 1 person isn't represented multiple times. Each person should only have 1 record with a date of the first time they did event A, and the first time they did event B. It is *not* meant to show retention (where people have the same event >= 0 times per period).

Usage

rt_explore_plot_conversion_rates(
  dataset,
  first_date,
  second_date,
  reference_date,
  group_variable = NULL,
  snapshots = c(1, 7, 14),
  snapshot_units = "days",
  date_floor = "month",
  color_or_facet = "color",
  year_over_year = FALSE,
  y_zoom_min = NULL,
  y_zoom_max = NULL,
  include_zero_y_axis = TRUE,
  show_points = FALSE,
  show_labels = FALSE,
  date_break_format = NULL,
  date_breaks_width = NULL,
  date_limits = NULL,
  base_size = 11
)

Arguments

dataset

dataframe

first_date

the reference date (e.g. first-touch point)

second_date

the date of conversion, NA if not converted

reference_date

we need to know how old the cohort is so we can determine if the

group_variable

a variable to group/facet by. If 'color_or_facet' will be ignored

snapshots

the numeric snapshots

snapshot_units

the units of the snapshots e.g. 'hours', 'days', 'weeks'

date_floor

how we should define the cohort group e.g. by 'day', 'by week', by 'months'

color_or_facet

display snaphosts by 'color' or 'facet'

year_over_year

if true it displays the graph year-over-year; 'color_or_facet' will be ignored

y_zoom_min

adjust (i.e. zoom in) to the y-axis; sets the minimum y-value for the adjustment

y_zoom_max

adjust (i.e. zoom in) to the y-axis; sets the maximum y-value for the adjustment

include_zero_y_axis

expand the lower bound of the y-axis to 0 (TRUE is best practice.)

show_points

if TRUE adds points to the graph

show_labels

if TRUE adds labels to each point

date_break_format

format of date breaks e.g. ''%Y-%m-%d''

date_breaks_width

the date breaks for x axis, values correspond to ggplot scale_x_date e.g. "1 month", "1 week"

date_limits

"zoom" for date x-axis, 2 values representing min/max in the format of YYYY-MM-DD. If 'date_floor' is used, the date_limits are converted to the corresponding date floor e.g. if date_floor is 'month' and date_limits are ‘c(’2013-01-15', '2013-12-15')‘ they will be converted to 'c(’2013-01-01', '2013-12-01')'

base_size

uses ggplot's base_size parameter for controling the size of the text

Details

Each record in the cohort must have had enough time to convert, in order to be shown in the graph. For example, say the snapshots we are interested in are at day 1 and day 7. If the cohort refers to February, and it is March 3rd, every record in the February cohort has had at least 1 day of "activity" or potential to convert, so we can include Feb for that snapshot. However, not everyone in Feb has had 7 days of activity, so we cannot yet include Feb for the 7 day snapshot, because people who joined the cohort on Feb 28, for example, have not had a full 7 days of potential activity.


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