Plots the actual repeat transactions for the given CLV data object.
# S3 method for clv.data plot( x, prediction.end = NULL, cumulative = FALSE, plot = TRUE, verbose = TRUE, ... )
The clv data object to plot
Until what point in time to predict. This can be the number of periods (numeric) or a form of date/time object. See details.
Whether the cumulative actual repeat transactions should be plotted.
Whether a plot should be created or only the assembled data returned.
Show details about the running of the function.
An object of class
ggplot from package
ggplot2 is returned by default.
If the parameter
FALSE, the data that would have been melted and used to
create the plot is returned. It is a
data.table which contains the following columns:
The timepoint that marks the end (up until and including) of the period to which the data in this row refers.
The number of actual repeat transactions in
the period that ends at
prediction.end indicates until when to predict or plot and can be given as either
a point in time (of class
character) or the number of periods.
prediction.end is of class character, the date/time format set when creating the data object is used for parsing.
prediction.end is the number of periods, the end of the fitting period serves as the reference point
from which periods are counted. Only full periods may be specified.
prediction.end is omitted or NULL, it defaults to the end of the holdout period if present and to the
end of the estimation period otherwise.
The first prediction period is defined to start right after the end of the estimation period.
If for example weekly time units are used and the estimation period ends on Sunday 2019-01-01, then the first day
of the first prediction period is Monday 2019-01-02. Each prediction period includes a total of 7 days and
the first prediction period therefore will end on, and include, Sunday 2019-01-08. Subsequent prediction periods
again start on Mondays and end on Sundays.
prediction.end indicates a timepoint on which to end, this timepoint is included in the prediction period.
If there are no repeat transactions until
prediction.end, only the time for which there is data
is plotted. If the data is returned (i.e. with argument
plot=FALSE), the respective rows
NA in column
Number of Repeat Transactions.
data("cdnow") clv.data.cdnow <- clvdata(cdnow, time.unit="w", estimation.split=37, date.format="ymd") # Plot the actual repeat transactions plot(clv.data.cdnow)#># plot cumulative repeat transactions plot(clv.data.cdnow, cumulative=TRUE)#># Dont automatically plot but tweak further gg.cdnow <- plot(clv.data.cdnow)#># Dont return a plot but only the data from # which it would have been created dt.plot.data <- plot(clv.data.cdnow, plot=FALSE)#>