gg_miss_span is a replacement function to imputeTS::plotNA.distributionBar(tsNH4, breaksize = 100), which shows the number of missings in a given span, or breaksize. A default minimal theme is used, which can be customised as normal for ggplot.

gg_miss_span(data, var, span_every, facet)

Arguments

data

data.frame

var

a bare unquoted variable name from data.

span_every

integer describing the length of the span to be explored

facet

(optional) a single bare variable name, if you want to create a faceted plot.

Value

ggplot2 showing the number of missings in a span (window, or breaksize)

See also

Examples

miss_var_span(pedestrian, hourly_counts, span_every = 3000)
#> # A tibble: 13 x 5 #> span_counter n_miss n_complete prop_miss prop_complete #> <int> <int> <dbl> <dbl> <dbl> #> 1 1 0 3000 0 1 #> 2 2 0 3000 0 1 #> 3 3 1 2999 0.000333 1.000 #> 4 4 121 2879 0.0403 0.960 #> 5 5 503 2497 0.168 0.832 #> 6 6 555 2445 0.185 0.815 #> 7 7 190 2810 0.0633 0.937 #> 8 8 0 3000 0 1 #> 9 9 1 2999 0.000333 1.000 #> 10 10 0 3000 0 1 #> 11 11 0 3000 0 1 #> 12 12 745 2255 0.248 0.752 #> 13 13 432 2568 0.144 0.856
library(ggplot2) gg_miss_span(pedestrian, hourly_counts, span_every = 3000)
gg_miss_span(pedestrian, hourly_counts, span_every = 3000, facet = sensor_name)
# works with the rest of ggplot gg_miss_span(pedestrian, hourly_counts, span_every = 3000) + labs(x = "custom")
gg_miss_span(pedestrian, hourly_counts, span_every = 3000) + theme_dark()
gg_miss_span(pedestrian, hourly_counts, span_every = 3000, facet = sensor_name)