Does a tsibble have implicit gaps in time?
Arguments
- .data
A tsibble.
- .full
- .name
Strings to name new columns.
- .start, .end
Set custom starting/ending time that allows to expand the existing time spans.
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)
#> # A tibble: 2 × 2
#> fruit .gaps
#> <chr> <lgl>
#> 1 cherry FALSE
#> 2 kiwi TRUE
has_gaps(harvest, .full = TRUE)
#> # A tibble: 2 × 2
#> fruit .gaps
#> <chr> <lgl>
#> 1 cherry TRUE
#> 2 kiwi TRUE
has_gaps(harvest, .full = start())
#> # A tibble: 2 × 2
#> fruit .gaps
#> <chr> <lgl>
#> 1 cherry TRUE
#> 2 kiwi TRUE
has_gaps(harvest, .full = end())
#> # A tibble: 2 × 2
#> fruit .gaps
#> <chr> <lgl>
#> 1 cherry FALSE
#> 2 kiwi TRUE