Description Usage Arguments Examples
This function calculates the share of grand total by a selected, grouping variable. If you want to caculate the share in a group by manner you can use the nest-mutate-map combination. See examples for an illustration.
1 |
df |
A a data frame |
grouping |
Variable to calculate the share for |
1 2 3 4 5 6 7 8 9 10 | recipes::credit_data %>%
first_to_lower() %>%
calculate_share(marital)
recipes::credit_data %>%
first_to_lower() %>%
nest(-marital) %>%
mutate(stats = purrr::map(data, calculate_share, job)) %>%
select(marital, stats) %>%
unnest()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.