abc
< Back to Reference | View source
abc()
ABC classification function
Usage
abc(.data, category_values, .value)Arguments
| Argument | Description |
|---|---|
.data |
tibble or dbi object (either grouped or ungrouped) |
category_values |
vector of break points between 0 and 1 |
.value |
optional: if left blank,abc() will use the number of rows per group to categorize, alternatively you can pass a column name to categorize |
Value
abc object
Description
For your group variable,
abc()will categorize which groups make up what proportion of the totals according to the category_values that you have enteredThe function returns a segment object which prints out the execution steps and actions that it will take to categorize your data
Use calculate to return the results
Details
This function is helpful to understand which groups of make up what proportion of the cumulative contribution
If you do not provide a
.valuethen it will count the transactions per group, if you provide.valuethen it willsum()the.valueper groupThe function creates a
segmentobject, which pre-processes the data into its components
Examples
contoso::sales |>
dplyr::group_by(product_key) |>
abc(c(.1,.5,.7,.96,1), .value = margin)