njtierney / naniar

Tidy data structures, summaries, and visualisations for missing data
http://naniar.njtierney.com/
Other
650 stars 54 forks source link

How does `miss_var_span` deal with remainders? #270

Closed njtierney closed 3 years ago

njtierney commented 4 years ago

Need to update the miss_var_span docs, and add a message describing the number of spans and the remainder left and how that is handled. There should be a warning message that describes whatever the final span is should be provided.

I need to think about how to best capture/describe this, but something like this to start,

When the number of observations isn't a perfect multiple of the span length, the final span is whatever the last remainder is. For example:

library(naniar)
test <- miss_var_span(pedestrian,
                      var = hourly_counts,
                      span_every = 4000)

sum(test$n_miss) + sum(test$n_complete)
#> [1] 40000

Created on 2020-08-27 by the reprex package (v0.3.0)

(Issue noted by Allison Horst)