elog2cum: Convert Event Log to Transaction Counts

Description Usage Arguments Details Value Examples

View source: R/helpers.R

Description

Aggregates an event log to either incremental or cumulative number of transactions. If first=TRUE then the initial transactions of each customer are included in the count as well.

Usage

1
2
3
elog2cum(elog, by = 7, first = FALSE)

elog2inc(elog, by = 7, first = FALSE)

Arguments

elog

Event log, a data.frame with columns cust and transaction time t or date.

by

Only return every by-th count Defaults to 7, and thus returns weekly numbers.

first

If TRUE, then the first transaction for each customer is being counted as well

Details

Duplicate transactions with identical cust and date (or t) field are counted only once.

Value

Numeric vector of transaction counts.

Examples

1
2
3
4
5
data("groceryElog")
cum <- elog2cum(groceryElog)
plot(cum, typ="l", frame = FALSE)
inc <- elog2inc(groceryElog)
plot(inc, typ="l", frame = FALSE)

Example output



BTYDplus documentation built on Jan. 21, 2021, 5:10 p.m.