Recency, frequency, monetary and RFM score

rfm_table(data = NULL, customer_id = NULL, order_date = NULL,
  revenue = NULL, analysis_date = NULL, recency_bins = 5,
  frequency_bins = 5, monetary_bins = 5, ...)

# S3 method for rfm_table
print(x, ...)

Arguments

data
a data.frame or tibble
customer_id
unique id of the customer
order_date
date of transaction
revenue
revenue from the customer
analysis_date
data of analysis
recency_bins
number of bins for recency
frequency_bins
number of bins for frequency
monetary_bins
number of bins for monetary
...
other arguments
x
an object of class rfm_table

Value

rfm_table returns a tibble with the following columns:

Examples

analysis_date <- lubridate::as_date('2006-12-31', tz = 'UTC') rfm_table(rfm_data, customer_id, order_date, revenue, analysis_date)
#> # A tibble: 995 x 9 #> customer_id date_most_recent recency_days transaction_count amount recency_score frequency_score monetary_score rfm_score #> <chr> <date> <dbl> <dbl> <dbl> <int> <int> <int> <dbl> #> 1 Abbey O'Reilly DVM 2006-06-09 205 6 472 3 4 3 343 #> 2 Add Senger 2006-08-13 140 3 340 4 1 2 412 #> 3 Aden Lesch Sr. 2006-06-20 194 4 405 3 2 3 323 #> 4 Admiral Senger 2006-08-21 132 5 448 4 3 3 433 #> 5 Agness O'Keefe 2006-10-02 90 9 843 5 5 5 555 #> 6 Aileen Barton 2006-10-08 84 9 763 5 5 5 555 #> 7 Ailene Hermann 2006-03-25 281 8 699 3 5 5 355 #> 8 Aiyanna Bruen PhD 2006-04-29 246 4 157 3 2 1 321 #> 9 Ala Schmidt DDS 2006-01-16 349 3 363 2 1 2 212 #> 10 Alannah Borer 2005-04-21 619 4 196 1 2 1 121 #> # ... with 985 more rows