has_gaps: Does a tsibble have implicit gaps in time?

View source: R/gaps.R

has_gapsR Documentation

Does a tsibble have implicit gaps in time?

Description

Does a tsibble have implicit gaps in time?

Usage

has_gaps(.data, .full = FALSE, .name = ".gaps", .start = NULL, .end = NULL)

Arguments

.data

A tsibble.

.full
  • FALSE inserts NA for each keyed unit within its own period.

  • TRUE fills NA over the entire time span of the data (a.k.a. fully balanced panel).

  • start() pad NA to the same starting point (i.e. ⁠min(<index>)⁠) across units.

  • end() pad NA to the same ending point (i.e. ⁠max(<index>)⁠) across units.

.name

Strings to name new columns.

.start, .end

Set custom starting/ending time that allows to expand the existing time spans.

Value

A tibble contains "key" variables and new column .gaps of TRUE/FALSE.

See Also

Other implicit gaps handling: count_gaps(), fill_gaps(), scan_gaps()

Examples

harvest <- tsibble(
  year = c(2010, 2011, 2013, 2011, 2012, 2013),
  fruit = rep(c("kiwi", "cherry"), each = 3),
  kilo = sample(1:10, size = 6),
  key = fruit, index = year
)
has_gaps(harvest)
has_gaps(harvest, .full = TRUE)
has_gaps(harvest, .full = start())
has_gaps(harvest, .full = end())

tsibble documentation built on June 27, 2024, 5:06 p.m.