View source: R/merge_periods.R
| merge_periods | R Documentation | 
Join adjacent or redundant time intervals across ids
merge_periods(
  df,
  start_time,
  end_time,
  ...,
  tolerance = 0,
  units = "minutes",
  simplify = TRUE,
  plots = FALSE
)
df | 
 A   | 
start_time | 
 The unquoted name of the starting time column in   | 
end_time | 
 The unquoted name of the ending time column in   | 
... | 
 Optional grouping columns, unquoted  | 
tolerance | 
 A number specifying how far apart start and end times can be to combine.  | 
units | 
 The units for tolerance. One of   | 
simplify | 
 Should the results be simplified and joined?  | 
plots | 
 Should plots be generated for each group?  | 
Sven Halvorson
data(periods_data)
merged_periods = merge_periods(
  periods_data,
  start_time = ts_start,
  end_time = ts_end,
  id,
  tolerance = 3,
  units = 'minutes',
  simplify = FALSE,
  plots = TRUE
)
SvenR::ggslideshow(merged_periods$plot)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.