make_triangles: Make Triangles

Description Usage Arguments Details Examples

Description

Convert triangles in tall format to a list of triangles in triangular format

Usage

1
2
3
4
5
6
make_triangles(transactions, format = "triangular",
  minLeftOrigin = NULL, originLength = 12, rowDev = 12,
  colDev = 12, lastValuationDate = NULL, fromMinLeftOrigin = TRUE,
  initialAge = originLength, colsFinancial = "auto", verbose = FALSE,
  colCustomerID = "CustomerID", colTransactionDate = "TransactionDate",
  method = "static")

Arguments

transactions

A data.table of with at least columns TransactionID, TransactionDate, CustomerID

format

How should the triangles be returned? Either "tall" (a data.table) or "triangular" (a list of data.tables)

minLeftOrigin

See ?triangle_skeleton

originLength

See ?triangle_skeleton

rowDev

See ?triangle_skeleton

colDev

See ?triangle_skeleton

lastValuationDate

See ?triangle_skeleton

fromMinLeftOrigin

See ?triangle_skeleton

initialAge

See ?triangle_skeleton

colsFinancial

What financial columns in transactions should generate triangles? Default="auto" guesses

verbose

Should progress details be displayed?

colCustomerID

Name of column representing customer id. Default="CustomerID"

colTransactionDate

Name of column representing transaction date Default="TransactionDate"

method

One of "static", "dynamic". If static, Age x is relative to the beginning of the cohort. If dynamic, Age x is relative to the acquisition date of each customer

Details

Returns a list of data.table objects

Examples

1
2
3
4
5
6
7
library(data.table)

set.seed(2357)
transactions <- sample_transactions(3, minDate=as.Date("2010-1-1"), maxDate=as.Date("2015-12-31"))
make_triangles(transactions)
make_triangles(transactions, colsFinancial=c("Amount"))
make_triangles(transactions, colsFinancial=c("Amount"), method = "dynamic")

ben519/trinalysis documentation built on May 12, 2019, 10:56 a.m.