packs_info {ruler} | R 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 ofexpose()
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 |
.object |
Object to get |
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()