validate_gran: Validate created granularities with existing columns

View source: R/create_gran.R

validate_granR Documentation

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

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"
)

Sayani07/gravitas documentation built on June 18, 2022, 2:40 a.m.