gravitas (version 0.1.2)

validate_gran: Validate created granularities with existing columns

Description

Validate created granularities with existing columns

Usage

validate_gran(
  .data,
  gran = NULL,
  hierarchy_tbl = NULL,
  validate_col = NULL,
  ...
)

Arguments

.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.

Value

A tsibble with an additional column of granularity.

Examples

Run this code
# NOT RUN {
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"
)
# }

Run the code above in your browser using DataLab