Learn R Programming

rfm (version 0.2.0)

rfm_table_order: RFM table (transaction data)

Description

Recency, frequency, monetary and RFM score.

Usage

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

Arguments

data

A data.frame or tibble.

customer_id

Unique id of the customer.

order_date

Date of the transaction.

revenue

Revenue from the customer.

analysis_date

Date 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.

Value

rfm_table_order returns a tibble with the following columns:

customer_id

Unique id of the customer.

date_most_recent

Date of the most recent transaction.

recency_days

Number of days since the most recent transaction.

transaction_count

Total number of transactions of the customer.

amount

Revenue from the customer.

recency_score

Recency score of the customer.

frequency_score

Frequency score of the customer.

monetary_score

Monetary score of the customer.

rfm_score

RFM score of the customer.

Examples

Run this code
# NOT RUN {
analysis_date <- lubridate::as_date('2006-12-31', tz = 'UTC')
rfm_table_order(rfm_data_orders, customer_id, order_date, revenue, analysis_date)

# access rfm table
result <- rfm_table_order(rfm_data_orders, customer_id, order_date, revenue, analysis_date)
result$rfm

# }

Run the code above in your browser using DataLab