Validate created granularities with existing columns
validate_gran( .data, gran = NULL, hierarchy_tbl = NULL, validate_col = NULL, ... )
.data | A tsibble object. |
---|---|
gran | the granularity to be created for validation. |
hierarchy_tbl | A hierarchy table. |
validate_col | A column in the data which acts as validator. |
... | Other arguments passed on to individual methods. |
A tsibble with an additional column of granularity.
library(dplyr) library(tsibble) cricket_tsibble <- cricket %>% mutate(data_index = row_number()) %>% as_tsibble(index = data_index) hierarchy_model <- tibble::tibble( units = c("index", "ball", "over", "inning", "match"), convert_fct = c(1, 6, 20, 2, 1) ) cricket_tsibble %>% validate_gran( gran = "over_inning", hierarchy_tbl = hierarchy_model, validate_col = "over" )#> [1] FALSE