# \donttest{
data("cdnow")
# create clv data object with weekly periods
# and no splitting
clv.data.cdnow <- clvdata(data.transactions = cdnow,
date.format="ymd",
time.unit = "weeks")
# same but split after 37 periods
clv.data.cdnow <- clvdata(data.transactions = cdnow,
date.format="ymd",
time.unit = "w",
estimation.split = 37)
# same but estimation end on the 15th Oct 1997
clv.data.cdnow <- clvdata(data.transactions = cdnow,
date.format="ymd",
time.unit = "w",
estimation.split = "1997-10-15")
# summary of the transaction data
summary(clv.data.cdnow)
# plot the total number of transactions per period
plot(clv.data.cdnow)
if (FALSE) {
# create data with the weekly periods defined to
# start on Mondays
# set start of week to Monday
oldopts <- options("lubridate.week.start"=1)
# create clv.data while Monday is the beginning of the week
clv.data.cdnow <- clvdata(data.transactions = cdnow,
date.format="ymd",
time.unit = "weeks")
# Dynamic covariates now have to be supplied for every Monday
# set week start to what it was before
options(oldopts)
}
# }
Run the code above in your browser using DataLab