Learn R Programming

ruler (version 0.1.3)

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

Value

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

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.

Examples

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

# }

Run the code above in your browser using DataLab