ca_to_ps_matrix {CADF}R Documentation

CADF to purchase string Extracts purchase strings from the CADF and formats as a R matrix.

Description

CADF to purchase string Extracts purchase strings from the CADF and formats as a R matrix.

Usage

ca_to_ps_matrix(ca.data, maxT)

Arguments

ca.data

Data in the CADF format generated by the CADF _to_CADF functions and Customer class.

maxT

Number of columns in the matrix

Details

Output is a matrix. Rows are number of customers; columns = maxT

Value

Matrix with dimensions C x maxT (number of customers by maxT) library(CADF) data("transactions") customer <- subset(transactions, transactions$ID == 40) today.study.cutoff <- max(customer$PURCHASE_DATE) customer.40.CADF <- list(Customer$new(customer, today.study.cutoff)) psmatrix <- customer.40.CADF$purchase_string_as_matrix psmatrix2 <- ca_to_ps_matrix(customer.40.CADF, 15)


[Package CADF version 0.1 Index]