rfm_plot_median_recency: Segmentation plots

Description Usage Arguments Examples

View source: R/rfm-segment.R

Description

Segment wise median recency, frequency & monetary value plot.

Usage

1
2
3
4
5
rfm_plot_median_recency(rfm_segment_table, print_plot = TRUE)

rfm_plot_median_frequency(rfm_segment_table, print_plot = TRUE)

rfm_plot_median_monetary(rfm_segment_table, print_plot = TRUE)

Arguments

rfm_segment_table

Output from rfm_segment.

print_plot

logical; if TRUE, prints the plot else returns a plot object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
analysis_date <- lubridate::as_date('2006-12-31')
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)

segments <- rfm_segment(rfm_result, segment_names, recency_lower,
recency_upper, frequency_lower, frequency_upper, monetary_lower,
monetary_upper)

rfm_plot_median_recency(segments)
rfm_plot_median_frequency(segments)
rfm_plot_median_monetary(segments)

rfm documentation built on July 21, 2020, 5:06 p.m.