Learn R Programming

BTYD (version 2.4.3)

dc.BuildCBTFromElog: Build Customer-by-Time Matrix from Event Log

Description

Creates a customer-by-time matrix from an event log.

Usage

dc.BuildCBTFromElog(elog, statistic = "freq")

Arguments

elog

event log, which is a data frame with columns for customer ID ("cust"), date ("date"), and optionally other columns such as "sales". Each row represents an event, such as a transaction.. For the total spend and average spend matrices, the event log must have a "sales" column. If the dates are not formatted to be in the order year-month-day, the columns of the customer-by-time matrix may not be ordered chronologically if the "date" column does not consist of date objects (R will order them alphabetically). This will cause problems with other functions, so it is better to convert the date column to date objects before running this function.

statistic

either "freq", "reach", "total.spend", or "average.spend". This determines what type of customer-by-time matrix is returned.

Value

Customer-by-time matrix.