Description Usage Arguments Details Examples
Convert triangles in tall format to a list of triangles in triangular format
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")
|
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 |
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 |
Returns a list of data.table objects
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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.