Skip to contents

Data for generating heatmap.

Usage

rfm_heatmap_data(rfm_table)

Arguments

rfm_table

An object of class rfm_table.

Examples

# using transaction data
analysis_date <- as.Date('2006-12-31')
rfm_order <- rfm_table_order(rfm_data_orders, customer_id, order_date,
revenue, analysis_date)

# heat map data
rfm_heatmap_data(rfm_order)
#>    frequency_score recency_score monetary
#> 1                1             1 208.3982
#> 2                1             2 246.9815
#> 3                1             3 246.3000
#> 4                1             4 213.4194
#> 5                1             5 262.1667
#> 6                2             1 380.5000
#> 7                2             2 407.5385
#> 8                2             3 355.0833
#> 9                2             4 375.1667
#> 10               2             5 370.0278
#> 11               3             1 530.2400
#> 12               3             2 516.6486
#> 13               3             3 446.6087
#> 14               3             4 451.8788
#> 15               3             5 467.0000
#> 16               4             1 575.4091
#> 17               4             2 599.4706
#> 18               4             3 603.7857
#> 19               4             4 617.0714
#> 20               4             5 564.5085
#> 21               5             1 746.6667
#> 22               5             2 873.1053
#> 23               5             3 846.9048
#> 24               5             4 866.4324
#> 25               5             5 862.4000

# using customer data
analysis_date <- as.Date('2007-01-01')
rfm_customer <- rfm_table_customer(rfm_data_customer, customer_id,
number_of_orders, recency_days, revenue, analysis_date)

# heat map data
rfm_heatmap_data(rfm_customer)
#>    frequency_score recency_score  monetary
#> 1                1             1  536.8644
#> 2                1             2  570.5215
#> 3                1             3  579.9108
#> 4                1             4  584.2790
#> 5                1             5  593.4045
#> 6                2             1  811.7163
#> 7                2             2  813.6919
#> 8                2             3  810.9384
#> 9                2             4  821.7216
#> 10               2             5  812.9264
#> 11               3             1  953.3083
#> 12               3             2  961.4024
#> 13               3             3  949.6547
#> 14               3             4  946.6957
#> 15               3             5  945.6492
#> 16               4             1 1091.6442
#> 17               4             2 1087.0097
#> 18               4             3 1090.6269
#> 19               4             4 1099.8690
#> 20               4             5 1096.4770
#> 21               5             1 1333.6814
#> 22               5             2 1368.3935
#> 23               5             3 1390.5560
#> 24               5             4 1385.8354
#> 25               5             5 1395.0101