Create segments based on recency, frequency and monetary scores.

rfm_segment(data, segment_names = NULL, recency_lower = NULL,
  recency_upper = NULL, frequency_lower = NULL, frequency_upper = NULL,
  monetary_lower = NULL, monetary_upper = NULL)

Arguments

data

An object of class rfm_table.

segment_names

Names of the segments.

recency_lower

Lower boundary for recency score.

recency_upper

Upper boundary for recency score.

frequency_lower

Lower boundary for frequency score.

frequency_upper

Upper boundary for frequency score.

monetary_lower

Lower boundary for monetary score.

monetary_upper

Upper boundary for monetary score.

Examples

analysis_date <- lubridate::as_date('2006-12-31', tz = 'UTC') rfm_result <- rfm_table_order(rfm_data_orders, customer_id, order_date, revenue, analysis_date) segment_names <- c("Champions", "Loyal Customers", "Potential Loyalist", "New Customers", "Promising", "Need Attention", "About To Sleep", "At Risk", "Can't Lose Them", "Lost") recency_lower <- c(4, 2, 3, 4, 3, 2, 2, 1, 1, 1) recency_upper <- c(5, 5, 5, 5, 4, 3, 3, 2, 1, 2) frequency_lower <- c(4, 3, 1, 1, 1, 2, 1, 2, 4, 1) frequency_upper <- c(5, 5, 3, 1, 1, 3, 2, 5, 5, 2) monetary_lower <- c(4, 3, 1, 1, 1, 2, 1, 2, 4, 1) monetary_upper <- c(5, 5, 3, 1, 1, 3, 2, 5, 5, 2) rfm_segment(rfm_result, segment_names, recency_lower, recency_upper, frequency_lower, frequency_upper, monetary_lower, monetary_upper)
#> # A tibble: 995 x 10 #> customer_id segment rfm_score transaction_cou~ recency_days amount #> <chr> <chr> <dbl> <dbl> <dbl> <dbl> #> 1 Abbey O'Reilly~ Loyal Custom~ 343 6 205 472 #> 2 Add Senger Potential Lo~ 412 3 140 340 #> 3 Aden Lesch Sr. Need Attenti~ 323 4 194 405 #> 4 Admiral Senger Potential Lo~ 433 5 132 448 #> 5 Agness O'Keefe Loyal Custom~ 555 9 90 843 #> 6 Aileen Barton Loyal Custom~ 555 9 84 763 #> 7 Ailene Hermann Loyal Custom~ 355 8 281 699 #> 8 Aiyanna Bruen ~ About To Sle~ 321 4 246 157 #> 9 Ala Schmidt DDS Lost 212 3 349 363 #> 10 Alannah Borer Lost 121 4 619 196 #> # ... with 985 more rows, and 4 more variables: date_most_recent <date>, #> # recency_score <int>, frequency_score <int>, monetary_score <int>