desc_groups_rank | R Documentation |
Similar to 'desc_groups' function, this one computes the rank of each value in order to quickly know what is the value in each segment that has the highest value (rank=1). 1 represent the highest number. It will exclude all factor/character variables.
desc_groups_rank(data, group_var, group_func = mean)
data |
input data source |
group_var |
variable to make the group by |
group_func |
the data type of this parameter is a function, not an string, this is the function to be used in the group by, the default value is: mean |
grouped data frame, showing the rank instead of the absolute values/
# default grouping function: mean
desc_groups_rank(data=mtcars, group_var="gear")
# using the median as the grouping function
desc_groups(data=mtcars, group_var="cyl", group_func=median)
# using the max as the grouping function
desc_groups_rank(data=mtcars, group_var="gear", group_func=max)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.