Validate the event-log and the items-and-returns dataset
to make sure that the transactions are valid.
Arguments
- elog
Event log, a data.frame with field
custfor the customer ID and fielddatefor the date/time of the event, which should be of type Date or POSIXt. Ifsalesorreturnsfield is present, it will be aggregated. See?elog_to_stanfor more information.- items_and_returns
Aggregated items and returns per customer.
Details
The validate_elog() function checks the following:
If there are any NA entries in any of the columns
If there are any non-positive number of items
If there are any non-positive amount of sales
The validate_items_and_returns() function checks the following:
If there are duplicated customer ID's
If there are any non-positive number of items
If there are any negative returns
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