complement_periods | R Documentation |
Find the complement of a set of time periods in a set of epochs.
For illustration, let's use integers instead of time periods and
epochs. Suppose we have two intervals/periods, {[1,3], [8,10]}
;
their complement in the set {[0, ..., 12]}
is {[0,0], [4,7], [11,12]}
.
complement_periods(periods, epochs, start_var, end_var)
periods |
A data frame with at least two columns,
|
epochs |
A data frame with at least one column,
|
start_var |
The variable (unquoted) which indicates when the time periods start. |
end_var |
The variable (unquoted) which indicates when the time periods end. |
A data frame of time periods with three columns:
period_id
(a sequential identifier), start_var
(first epoch in period) and end_var
(last epoch in period).
library("lubridate") library("dplyr") periods <- tibble( start = ymd_hm("2017-01-01 00:01"), end = ymd_hm("2017-01-01 00:05") ) epochs <- tibble(timestamp = ymd_hm("2017-01-01 00:00") + minutes(0:12)) complement_periods(periods, epochs, start, end)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.