# NOT RUN {
# Implicit missing time without group_by ----
# All the sensors have 2 common missing time points in the data
count_gaps(pedestrian)
# Time gaps for each sensor per month ----
pedestrian %>%
index_by(yrmth = yearmonth(Date)) %>%
group_by(Sensor) %>%
count_gaps()
# Time gaps for each sensor ----
ped_gaps <- pedestrian %>%
group_by(Sensor) %>%
count_gaps(.full = TRUE)
if (!requireNamespace("ggplot2", quietly = TRUE)) {
stop("Please install the ggplot2 package to run these following examples.")
}
library(ggplot2)
ggplot(ped_gaps, aes(colour = Sensor)) +
geom_linerange(aes(x = Sensor, ymin = from, ymax = to)) +
geom_point(aes(x = Sensor, y = from)) +
geom_point(aes(x = Sensor, y = to)) +
coord_flip() +
theme(legend.position = "bottom")
# Vectors ----
gaps(x = c(1:3, 5:6, 9:10), y = 1:10)
# }
Run the code above in your browser using DataLab