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 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 data.table
as.clv.data(
  x,
  date.format = "ymd",
  time.unit = "weeks",
  estimation.split = NULL,
  name.id = "Id",
  name.date = "Date",
  name.price = "Price",
  ...
)

Arguments

x

Transaction data.

date.format

Character string that indicates the format of the date variable in the data used. See details.

time.unit

What time unit defines a period. May be abbreviated, capitalization is ignored. See details.

estimation.split

Indicates the length of the estimation period. See details.

name.id

Column name of the customer id in x.

name.date

Column name of the transaction date in x.

name.price

Column name of price in x. NULL if no spending data is present.

...

Ignored

Details

See section "Details" of clvdata for more details on parameters and usage.

Examples

 # 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)