Skip to contents

Validate the event-log and the items-and-returns dataset to make sure that the transactions are valid.

Usage

validate_elog(elog)

validate_items_returns(items_and_returns)

Arguments

elog

Event log, a data.frame with field cust for the customer ID and field date for the date/time of the event, which should be of type Date or POSIXt. If sales or returns field is present, it will be aggregated. See ?elog_to_stan for more information.

items_and_returns

Aggregated items and returns per customer.

Details

The validate_elog() function checks the following:

  1. If there are any NA entries in any of the columns

  2. If there are any non-positive number of items

  3. If there are any non-positive amount of sales

The validate_items_and_returns() function checks the following:

  1. If there are duplicated customer ID's

  2. If there are any non-positive number of items

  3. If there are any negative returns

  4. If the returns value is higher than the items value

Examples

config <- appraise_configure(sample = FALSE,
                             cpa = c(25, 50, 75, 100, 125, 150, 200),
                             cm =  c(.2, .3, .432, .5),
                             currency = '$',
                             n_forecast =  5 * 52)

elog_validated <- validate_elog(elog)
#> Checking sales data...
#> -------------------------
#> Following `elog` issues were found:
#> nonpos_items nonpos_sales 
#>            1          188 
items_and_returns_validated <- validate_items_returns(returns)
#> 
#> Checking returns data...
#> -------------------------
#> Following `items_and_returns` issues were found:
#> more_returns 
#>            5