count_gaps: Count implicit gaps

Description Usage Arguments Value See Also Examples

View source: R/gaps.R

Description

Count implicit gaps

Usage

1
count_gaps(.data, .full = FALSE, .name = c(".from", ".to", ".n"))

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). Other options are start() and end(), suggesting to pad NA for the same min(<index>) or max(<index>) alignment time across the units.

.name

Strings to name new columns.

Value

A tibble contains:

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
ped_gaps <- pedestrian %>%
  count_gaps(.full = TRUE)
ped_gaps
if (!requireNamespace("ggplot2", quietly = TRUE)) {
  stop("Please install the ggplot2 package to run these following examples.")
}
library(ggplot2)
ggplot(ped_gaps, aes(x = Sensor, colour = Sensor)) +
  geom_linerange(aes(ymin = .from, ymax = .to)) +
  geom_point(aes(y = .from)) +
  geom_point(aes(y = .to)) +
  coord_flip() +
  theme(legend.position = "bottom")

tidyverts/tsibble documentation built on April 6, 2020, 9:53 p.m.