This function takes a records file with unique policy identifiers in the column "key", exposure start dates in column "start" and exposure end dates in column "end". The output is a data frame with exposures and durations for time intervals.

addExposures(records, type = "PY", lower_year = NULL,
  upper_year = NULL)

Arguments

records

File containing a unique policy key with start and end dates.

type

Creates policy year rows for the default type = "PY". Creates policy month rows for type = "PM".

lower_year

A lower year for truncation to reduce calculation time and output size.

upper_year

An upper year for truncation to reduce calculation time and output size.

Value

A data frame with multiple rows for each unique policy key. Each row represents a policy interval.

Examples

addExposures(records)
#> # A tibble: 24 x 5 #> key duration start_int end_int exposure #> <chr> <dbl> <date> <date> <dbl> #> 1 B10251C8 1 2010-04-10 2011-04-09 0.999 #> 2 B10251C8 2 2011-04-10 2012-04-09 1.00 #> 3 B10251C8 3 2012-04-10 2013-04-09 0.999 #> 4 B10251C8 4 2013-04-10 2014-04-09 0.999 #> 5 B10251C8 5 2014-04-10 2015-04-09 0.999 #> 6 B10251C8 6 2015-04-10 2016-04-09 1.00 #> 7 B10251C8 7 2016-04-10 2017-04-09 0.999 #> 8 B10251C8 8 2017-04-10 2018-04-09 0.999 #> 9 B10251C8 9 2018-04-10 2019-04-04 0.986 #> 10 D68554D5 1 2005-01-01 2005-12-31 0.999 #> # ... with 14 more rows