Cross tabulation of granularities useful for validating if number of observations are sufficient to compute probability distributions

gran_obs(.data, gran1, gran2, hierarchy_tbl = NULL)

Arguments

.data

A tsibble object.

gran1

One of the temporal granularities to check for harmonies.

gran2

The second temporal granularity in the pair.

hierarchy_tbl

A hierarchy table specifying the hierarchy of units and their relationships for non-temporal case.

Value

A tibble with number of observations for each granularity.

Examples

library(tsibbledata) vic_elec %>% gran_obs("hour_day", "day_week")
#> # A tibble: 7 x 25 #> day_week `0` `1` `2` `3` `4` `5` `6` `7` `8` `9` `10` #> <ord> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 Mon 314 314 314 314 314 314 314 314 314 314 314 #> 2 Tue 314 314 314 314 314 314 314 314 314 314 314 #> 3 Wed 314 314 314 314 314 314 314 314 314 314 314 #> 4 Thu 312 312 312 312 312 312 312 312 312 312 312 #> 5 Fri 312 312 312 312 312 312 312 312 312 312 312 #> 6 Sat 312 312 312 312 312 312 312 312 312 312 312 #> 7 Sun 314 314 314 314 314 314 314 314 314 314 314 #> # … with 13 more variables: `11` <dbl>, `12` <dbl>, `13` <dbl>, `14` <dbl>, #> # `15` <dbl>, `16` <dbl>, `17` <dbl>, `18` <dbl>, `19` <dbl>, `20` <dbl>, #> # `21` <dbl>, `22` <dbl>, `23` <dbl>