dominant_epoch {LightLogR} | R Documentation |
Determine the dominant epoch/interval of a dataset
Description
Calculate the dominant epoch/interval of a dataset. The dominant epoch/interval is the epoch/interval that is most frequent in the dataset. The calculation is done per group, so that you might get multiple variables. If two or more epochs/intervals are equally frequent, the first one (shortest one) is chosen.
Usage
dominant_epoch(dataset, Datetime.colname = Datetime)
Arguments
dataset |
A light logger dataset. Needs to be a dataframe. |
Datetime.colname |
The column that contains the datetime. Needs to be a
|
Value
A tibble
with one row per group and a column with the
dominant.epoch
as a lubridate::duration()
. Also a column with the
group.indices
, which is helpful for referencing the dominant.epoch
across dataframes of equal grouping.
See Also
Other regularize:
gap_finder()
,
gap_handler()
,
gapless_Datetimes()
Examples
dataset <-
tibble::tibble(Id = c("A", "A", "A", "B", "B", "B"),
Datetime = lubridate::as_datetime(1) +
lubridate::days(c(0:2, 4, 6, 8)))
dataset
#get the dominant epoch by group
dataset %>%
dplyr::group_by(Id) %>%
dominant_epoch()
#get the dominant epoch of the whole dataset
dataset %>%
dominant_epoch()
[Package LightLogR version 0.3.8 Index]