Lump variable into grouped factors

tbl_fct_lump(
  data,
  grouping_variables = NULL,
  variable = NULL,
  new_variable = NULL,
  n_unique = NULL,
  weight = NULL,
  other_level = NULL,
  include_group = T,
  impute_na = T,
  order_factors = F,
  return_message = T
)

Arguments

grouping_variables

Value

Examples

tbl_fct_lump(data = ggplot2::diamonds, variable = "color", n_unique = 3, weight = "price")
tbl_fct_lump(data = ggplot2::diamonds, variable = "color", n_unique = 3, weight = "price", new_variable = "group_color")
tbl_fct_lump( data = ggplot2::diamonds, variable = "color", n_unique = 3, grouping_variables = c("cut"), weight = "price", new_variable = "group_color")
tbl_fct_lump( data = ggplot2::diamonds, variable = "color", n_unique = 3, grouping_variables = c("cut", "clarity"), weight = "price", new_variable = "group_color")


library(asbviz)
library(tidyverse)
mtcars %>% rownames_to_column("car") %>% as_tibble() %>% tbl_fct_lump(variable = "car", n_unique = 5, weight = "wt") %>% hc_xy(x = "drat", y = "mpg", group = "group_car_lumped", name = "car")