rfm: RFM from orders.

Description Usage Arguments Value

Description

rfm returns an RFM object from a customer order tbl or data frame.

Usage

1
rfm(orders_df, cust_id, order_date, order_value, as_of_date = NA)

Arguments

orders_df

An orders table with one row per order and columns corresponding to the next three arguments.

cust_id

A string with the column name with a unique identifier for the customer (typically integer or character).

order_date

A string with the column name of the date of the order (Date).

order_value

A string with the column name of the value of the order (numeric).

as_of_date

An optional Date giving the orders_df "as-of-date". If omitted, last order_date will be used.

Value

A tbl with the columns for each customer:

unique identifier

Actual column name taken from "cust_id"

last_on

Last order date (Date)

first_on

First order date (Date)

Frequency

Number of orders (integer)

Monetary

Total value of orders (numeric)

Recency

Number of days between last order and as-of-date (integer)

tenure

Number of days between first order and as-of-date (integer)

Note that the tbl is ungrouped.


ds4ci/rfmr documentation built on May 15, 2019, 2:56 p.m.