Title: | Cohort Analysis Made Easy |
Version: | 1.0.1 |
Description: | Functions to simplify the process of preparing event and transaction for cohort analysis. |
License: | MIT + file LICENSE |
URL: | https://github.com/PeerChristensen/cohorts |
BugReports: | https://github.com/PeerChristensen/cohorts/issues |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.1.1 |
Imports: | data.table, dplyr, dtplyr, magrittr, tibble, tidyr, zoo |
Depends: | R (≥ 2.10) |
Suggests: | testthat (≥ 3.0.0) |
Config/testthat/edition: | 3 |
NeedsCompilation: | no |
Packaged: | 2022-05-15 21:55:11 UTC; peerchristensen |
Author: | Peer Christensen [aut, cre] |
Maintainer: | Peer Christensen <hr.pchristensen@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2022-05-15 22:10:05 UTC |
Pipe operator
Description
See magrittr::%>%
for details.
Usage
lhs %>% rhs
Arguments
lhs |
A value or the magrittr placeholder. |
rhs |
A function call using the magrittr semantics. |
Value
The result of calling rhs(lhs)
.
Create a Cohort Table Using Day Level Event Data
Description
Creates a cohort table with day level event data with rows corresponding to cohort numbers and columns as dates.
Usage
cohort_table_day(df, id_var, date)
Arguments
df |
Dataframe |
id_var |
ID variable |
date |
Date |
Value
Cohort table
Examples
cohort_table_day(gamelaunch, userid, eventDate)
Create a Cohort Table Using Month Level Event Data
Description
Creates a cohort table with month level event data with rows corresponding to cohort numbers and columns as months.
Usage
cohort_table_month(df, id_var, date)
Arguments
df |
Dataframe |
id_var |
ID variable |
date |
Date |
Value
Cohort table
Examples
cohort_table_month(online_cohorts, CustomerID, InvoiceDate)
Convert Values of a Cohort Table to Percentages
Description
Converts values of a cohort table to percentages of initial cohort sizes.
Usage
cohort_table_pct(cohort_table, decimals = 1)
Arguments
cohort_table |
Cohort table |
decimals |
Integer |
Value
Cohort table
Examples
online_cohorts %>%
cohort_table_month(CustomerID, InvoiceDate) %>%
cohort_table_pct(decimals = 1)
Event Data From the Launch of a Mobile Game
Description
A dataset containing 29324 observations with three columns: userid, eventDate and eventName.
Usage
gamelaunch
Format
A data frame with 29324 rows and 3 variables:
- userid
User ID
- eventDate
Event Date
- eventName
Event Name
...
Order Data From an Online Store
Description
A dataset containing 19573 observations with two columns: CustomerID and InvoiceDate
Usage
online_cohorts
Format
A data frame with 19,573 rows and 2 variables:
- CustomerID
Customer ID
- InvoiceDate
InvoiceDate
...
Left-shift a Cohort Table
Description
Left-shifts a cohort table
Usage
shift_left(cohort_table)
Arguments
cohort_table |
Cohort table |
Value
Cohort table
Examples
online_cohorts %>%
cohort_table_month(CustomerID, InvoiceDate) %>%
shift_left()
Left-shift a Cohort Table With Cohort Sizes as Percentages
Description
Left-shifts a cohort table with cohort sizes as percentages of start sizes.
Usage
shift_left_pct(cohort_table, decimals = 1)
Arguments
cohort_table |
Cohort table |
decimals |
Integer |
Value
Cohort table
Examples
online_cohorts %>%
cohort_table_month(CustomerID, InvoiceDate) %>%
shift_left_pct()