{CLVTools}R Documentation

Plot actual repeat transactions


Plots the actual repeat transactions for the given CLV data object.


## S3 method for class ''
  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.




prediction.end indicates until when to predict or plot and can be given as either a point in time (of class Date, POSIXct, or character) or the number of periods. If prediction.end is of class character, the date/time format set when creating the data object is used for parsing. If 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. If 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. If 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 contain NA in column Number of Repeat Transactions.


An object of class ggplot from package ggplot2 is returned by default. If the parameter plot is 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.

Number of Repeat Transactions

The number of actual repeat transactions in the period that ends at period.until.


data("cdnow") <- clvdata(cdnow, time.unit="w",

# Plot the actual repeat transactions

# plot cumulative repeat transactions
plot(, cumulative=TRUE)

# Dont automatically plot but tweak further
gg.cdnow <- plot(

# change Title
gg.cdnow + ggtitle("CDnow repeat transactions")

# Dont return a plot but only the data from
#   which it would have been created <- plot(, plot=FALSE)

[Package CLVTools version 0.8.0 Index]