Title: | Cohort Analysis Made Easy |
---|---|
Description: | Functions to simplify the process of preparing event and transaction for cohort analysis. |
Authors: | Peer Christensen [aut, cre] |
Maintainer: | Peer Christensen <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.2.0 |
Built: | 2025-02-20 03:13:59 UTC |
Source: | https://github.com/peerchristensen/cohorts |
Creates a cohort table with day level event data with rows corresponding to cohort numbers and columns as dates.
cohort_table_day(df, id_var, date)
cohort_table_day(df, id_var, date)
df |
Dataframe |
id_var |
ID variable |
date |
Date |
Cohort table
cohort_table_day(gamelaunch, userid, eventDate)
cohort_table_day(gamelaunch, userid, eventDate)
Creates a cohort table with month level event data with rows corresponding to cohort numbers and columns as months.
cohort_table_month(df, id_var, date)
cohort_table_month(df, id_var, date)
df |
Dataframe |
id_var |
ID variable |
date |
Date |
Cohort table
cohort_table_month(online_cohorts, CustomerID, InvoiceDate)
cohort_table_month(online_cohorts, CustomerID, InvoiceDate)
Converts values of a cohort table to percentages of initial cohort sizes.
cohort_table_pct(cohort_table, decimals = 1)
cohort_table_pct(cohort_table, decimals = 1)
cohort_table |
Cohort table |
decimals |
Integer |
Cohort table
online_cohorts %>% cohort_table_month(CustomerID, InvoiceDate) %>% cohort_table_pct(decimals = 1)
online_cohorts %>% cohort_table_month(CustomerID, InvoiceDate) %>% cohort_table_pct(decimals = 1)
Creates a cohort table with week level event data with rows corresponding to cohort numbers and columns as dates.
cohort_table_week(df, id_var, date)
cohort_table_week(df, id_var, date)
df |
Dataframe |
id_var |
ID variable |
date |
Date |
Cohort table
cohort_table_week(gamelaunch, userid, eventDate)
cohort_table_week(gamelaunch, userid, eventDate)
Creates a cohort table with year level event data with rows corresponding to cohort numbers and columns as dates.
cohort_table_year(df, id_var, date)
cohort_table_year(df, id_var, date)
df |
Dataframe |
id_var |
ID variable |
date |
Date |
Cohort table
cohort_table_week(gamelaunch, userid, eventDate)
cohort_table_week(gamelaunch, userid, eventDate)
A dataset containing 29324 observations with three columns: userid, eventDate and eventName.
gamelaunch
gamelaunch
A data frame with 29324 rows and 3 variables:
User ID
Event Date
Event Name
...
A dataset containing 19573 observations with two columns: CustomerID and InvoiceDate
online_cohorts
online_cohorts
A data frame with 19,573 rows and 2 variables:
Customer ID
InvoiceDate
...
Left-shifts a cohort table
shift_left(cohort_table)
shift_left(cohort_table)
cohort_table |
Cohort table |
Cohort table
online_cohorts %>% cohort_table_month(CustomerID, InvoiceDate) %>% shift_left()
online_cohorts %>% cohort_table_month(CustomerID, InvoiceDate) %>% shift_left()
Left-shifts a cohort table with cohort sizes as percentages of start sizes.
shift_left_pct(cohort_table, decimals = 1)
shift_left_pct(cohort_table, decimals = 1)
cohort_table |
Cohort table |
decimals |
Integer |
Cohort table
online_cohorts %>% cohort_table_month(CustomerID, InvoiceDate) %>% shift_left_pct()
online_cohorts %>% cohort_table_month(CustomerID, InvoiceDate) %>% shift_left_pct()