cohort_summarise: Create cohort data

cohort_summariseR Documentation

Create cohort data

Description

cohort_summarise() perform cohort analysis by summarizing variable. For example, sum() of revenue of each cohort.

Usage

cohort_summarise(
  data,
  .id_col,
  .time_col,
  .summarise_col,
  .fn = c("mean"),
  ...,
  time_unit = c("week", "month", "quarter", "year"),
  percent_form = TRUE,
  relative_time = TRUE,
  all_group = FALSE
)

Arguments

data

Input data

.id_col

Variable to identify entities (maybe customer ID)

.time_col

Time correspond to id_col. Must be in date or date-time format

.summarise_col

Variable to perform summarise on

.fn

Function to perform summarise, in character form.default is "sum". This function should return length 1 numeric value,

...

Additional argument pass to .fn

time_unit

Time unit to group to cohort

percent_form

Should return table contain percentage value or absolute value

relative_time

Should return column is relative time or absolute period

all_group

Should result include group of all entities. This argument must only set to TRUE when both percent_form and relative_time is TRUE


vohai611/rcohort documentation built on April 13, 2022, 6:40 a.m.