This function takes in exposures and transactions and returns all transactions with a matching "key" and "trans_date" within an exposure interval and attaches the start date of the corresponding exposure interval. This is useful for grouping by start date and key, aggregating, and joining to the exposure rows. In this way premium pattern analysis can be performed.

addStart(trans, exposures)

Arguments

trans

Information we wish to assign to exposure intervals.

exposures

Output from addExposures(records).

Value

Modified transaction records that corresponding to an exposure interval, the interval start date is included.

Examples

addStart(trans, exposures)
#> # A tibble: 157 x 4 #> start_int key trans_date amt #> <date> <chr> <date> <dbl> #> 1 2010-04-10 B10251C8 2010-05-28 190 #> 2 2010-04-10 B10251C8 2010-07-04 189 #> 3 2010-04-10 B10251C8 2010-11-21 179 #> 4 2011-04-10 B10251C8 2011-05-08 210 #> 5 2011-04-10 B10251C8 2011-07-12 198 #> 6 2011-04-10 B10251C8 2012-01-14 194 #> 7 2011-04-10 B10251C8 2012-02-18 208 #> 8 2012-04-10 B10251C8 2012-04-15 206 #> 9 2012-04-10 B10251C8 2012-04-30 193 #> 10 2012-04-10 B10251C8 2012-05-23 205 #> # ... with 147 more rows