time_gaps | R Documentation |
time_gaps()
checks for implicit missing gaps in time for any
regular date or datetime sequence.
time_gaps(
x,
timespan = granularity(x),
g = NULL,
use.g.names = TRUE,
check_time_regular = FALSE
)
time_num_gaps(
x,
timespan = granularity(x),
g = NULL,
use.g.names = TRUE,
na.rm = TRUE,
check_time_regular = FALSE
)
time_has_gaps(
x,
timespan = granularity(x),
g = NULL,
use.g.names = TRUE,
na.rm = TRUE,
check_time_regular = FALSE
)
x |
Time vector. |
timespan |
timespan. |
g |
Grouping object passed directly to |
use.g.names |
Should the result include group names?
Default is |
check_time_regular |
Should the time vector be
checked to see if it is regular (with or without gaps)?
Default is |
na.rm |
Should |
When check_time_regular
is TRUE, x
is passed to
time_is_regular
, which checks that the time elapsed between successive
values are in increasing order and are whole numbers.
For more strict checks, see ?time_is_regular
.
time_gaps
returns a vector of time gaps.
time_num_gaps
returns the number of time gaps.
time_has_gaps
returns a logical(1) of whether there are gaps.
library(timeplyr)
library(fastplyr)
library(lubridate)
library(nycflights13)
missing_dates(flights$time_hour)
time_has_gaps(flights$time_hour)
time_num_gaps(flights$time_hour)
length(time_gaps(flights$time_hour))
time_num_gaps(flights$time_hour, g = flights$origin)
# Number of missing hours by origin and dest
flights %>%
f_group_by(origin, dest) %>%
f_summarise(n_missing = time_num_gaps(time_hour, "hours"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.