packs_info: Packs info

packs_infoR Documentation

Packs info

Description

An S3 class packs_info to represent information about packs in exposure. It is a tibble with the following structure:

  • name ⁠<chr>⁠ : Name of the pack.

  • type ⁠<chr>⁠ : Pack type.

  • fun ⁠<list>⁠ : List (preferably unnamed) of rule pack functions.

  • remove_obeyers ⁠<lgl>⁠ : value of .remove_obeyers argument of expose() with which pack was applied.

Usage

is_packs_info(.x, .skip_class = FALSE)

get_packs_info(.object)

Arguments

.x

Object to test.

.skip_class

Whether to skip checking inheritance from packs_info.

.object

Object to get packs_info value from exposure attribute.

Details

To avoid possible confusion it is preferred (but not required) that list-column fun doesn't have names. Names of packs are stored in name column. During exposure fun is always created without names.

Value

get_packs_info() returns packs_info attribute of object if it is exposure and of its 'exposure' attribute otherwise.

Examples

my_row_packs <- row_packs(
  row_mean_props = . %>% dplyr::transmute(row_mean = rowMeans(.)) %>%
    dplyr::transmute(
      row_mean_low = row_mean > 20,
      row_mean_high = row_mean < 60
    ),
  row_outlier = . %>% dplyr::transmute(row_sum = rowSums(.)) %>%
    dplyr::transmute(
      not_row_outlier = abs(row_sum - mean(row_sum)) / sd(row_sum) < 1.5
    )
)
my_data_packs <- data_packs(
  data_dims = . %>% dplyr::summarise(
    nrow = nrow(.) == 32,
    ncol = ncol(.) == 5
  )
)

mtcars_exposed <- mtcars %>%
  expose(my_data_packs, .remove_obeyers = FALSE) %>%
  expose(my_row_packs)

mtcars_exposed %>% get_packs_info()

mtcars_exposed %>%
  get_packs_info() %>%
  is_packs_info()

ruler documentation built on March 31, 2023, 8:13 p.m.