An S3 class packs_info
to represent information about packs in exposure.
It is a tibble with the following structure:
is_packs_info(.x, .skip_class = FALSE)
get_packs_info(.object)
Object to test.
Whether to skip checking inheritance from packs_info
.
Object to get packs_info
value from exposure
attribute.
get_packs_info()
returns packs_info
attribute of object
if it
is exposure and of its 'exposure' attribute otherwise.
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.
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()
#> Packs info:
#> # A tibble: 3 × 4
#> name type fun remove_obeyers
#> <chr> <chr> <list> <lgl>
#> 1 data_dims data_pack <data_pck> FALSE
#> 2 row_mean_props row_pack <row_pack> TRUE
#> 3 row_outlier row_pack <row_pack> TRUE
mtcars_exposed %>%
get_packs_info() %>%
is_packs_info()
#> [1] TRUE