overlap_functions: WCCMH admission functions

Description Usage Arguments Value Note Examples

Description

These functions are for datasets that have integer or date columns that need to be combined by some unique grouping or with the additional constraint of a priority column when the priority column causes an overlap outside of the unique grouping but within the priority column.

Usage

1
2
3
4
5
overlap_combine(data, group_cols, start_col, end_col, overlap_int = 1L,
  analysis_date = Sys.Date())

priority_overlap(data, group_cols, priority_col, priority_int, start_col,
  end_col, overlap_int = 1L, analysis_date = Sys.Date() + 999)

Arguments

data

A data.table object with collapsable records.

group_cols

A group of columns which will collectively make a key on which to group by when reducing/collapsing the data.table object.

start_col

The start date for record. Blanks not allowed.

end_col

The end date for the record. Blanks will be replaced, see

overlap_int

An integer, default value of 1, to find consecutive records.

analysis_date

If end_col has missing values, they will be replaced with this value. Defaults to Sys.Date().

priority_col

A single column which will have a priority assignment.

priority_int

A positive integer for priority, 1 being highest priority and each consecutive integer of lower priority than the previous.

Value

overlap_combine returns a reduced/collapsed data.table object based on group_cols. priority_overlap returns a data.table with fixed records based on priority team assignment. May contain more rows than original dataset.

Note

Do not have data columns named strdt, enddt, pk_1, pk_2, ... You have been warned! MAJOR rewrite coming eventually... hopefully backward compatible

Examples

1
2
3
data(ex_overlap)
suppressWarnings(overlap_combine(data = ex_overlap, group_cols = Cc(team, priority),
 start_col = Cc(team_start), end_col = Cc(team_end)) %>% print)

JamesDalrymple/wccmh documentation built on May 7, 2019, 10:20 a.m.