aggregateVintageData: Aggregate vintage data

Description Usage Arguments Examples

Description

This function aggregates already calculated vintage data by removing or keeping selected Slicers.

Usage

1
2
aggregateVintageData(vintageData = NULL, slicers = NA, type = "include",
  timeAggregationUnit = 1, sqlModifier = NA, verbose = FALSE)

Arguments

vintageData

Result of function getVintageData or data frame with the same structure. At least the following columns have to be present: distance, vintage_unit_weight, vintage_unit_count, event_weight, event_weight_pct, event_weight_csum, event_weight_csum_pct

slicers

Vector of slicers which should be included or excluded.

type

Indicating inclusion or exclusion of slicers. Default is to include specified slicers. Possible values are include and exclude.

timeAggregationUnit

Defines how distance should be aggregated. By default, distance is not modified at all. When specified, single integer has to be used. For example using value 3 and distance values in vintageData 0,1,2,3,4,5,6,7,8,9 the result will be aggregated to 0,1,2,3 ((0,1,2)->0, (3,4,5)->1, (6,7,8)->2, (9)->3).

sqlModifier

Optional WHERE clause to filter vintageData before aggretation

verbose

If true, then additional diagnostic messages are displayed. Default is FALSE.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Aggregations ##########################

# Show data by region
aggregateVintageData(vintageData, slicers = 'region')
# Show data by origination_month
aggregateVintageData(vintageData, slicers = 'origination_month')
# By product and region
aggregateVintageData(vintageData, slicers = c('region','product'))
#Everything but origination_month
aggregateVintageData(vintageData, slicers = 'origination_month', type = 'exclude')
#Everything but origination_month
aggregateVintageData(vintageData, slicers = 'origination_month', type = 'exclude')
#Exclude all slicers, only distance will be displayed
aggregateVintageData(vintageData, type = 'include')
#Exclude all slicers and aggregate also distance (set high timeAggregationUnit parameter)
aggregateVintageData(vintageData, type = 'include', timeAggregationUnit = 1000)
#Keep only product dimension, only product "Giga Loan"
aggregateVintageData(vintageData, slicers = 'product', sqlModifier = "product = 'Giga Loan'")
#Keep only product dimension, only product "Giga Loan" and region "West"
aggregateVintageData(vintageData, slicers = 'product', sqlModifier = "product = 'Giga Loan' and region = 'West'")
# Show diagnostic messages
aggregateVintageData(vintageData, slicers = 'region', verbose = TRUE)

tomasgreif/vintager documentation built on May 31, 2019, 5:16 p.m.