Functions to coerce transaction data to a clv.data
object.
as.clv.data(
x,
date.format = "ymd",
time.unit = "weeks",
estimation.split = NULL,
name.id = "Id",
name.date = "Date",
name.price = "Price",
...
)
# S3 method for class 'data.frame'
as.clv.data(
x,
date.format = "ymd",
time.unit = "weeks",
estimation.split = NULL,
name.id = "Id",
name.date = "Date",
name.price = "Price",
...
)
# S3 method for class 'data.table'
as.clv.data(
x,
date.format = "ymd",
time.unit = "weeks",
estimation.split = NULL,
name.id = "Id",
name.date = "Date",
name.price = "Price",
...
)
Transaction data.
Character string that indicates the format of the date variable in the data used. See details.
What time unit defines a period. May be abbreviated, capitalization is ignored. See details.
Indicates the length of the estimation period. See details.
Column name of the customer id in x
.
Column name of the transaction date in x
.
Column name of price in x
. NULL if no spending data is present.
Ignored
See section "Details" of clvdata for more details on parameters and usage.
# dont test because ncpu=2 limit on cran (too fast)
data(cdnow)
# Turn data.table of transaction data into a clv.data object,
# using default date format and column names but no holdout period
clv.cdnow <- as.clv.data(cdnow)