Manipulates a data frame ready for plotting with the waffle_chart function.

waffleize(dt, fill, value, composition = TRUE, max_value = NULL, digits = 3)

Arguments

dt

data frame containing the data which should be transformed

fill

character specifying the column name which should be used as fill for the waffle plot.

value

character specifying the column name which contains values of the fill variable.

composition

logical indicating whether a compositional waffle (i.e. fill adds up to 100%) should be created. If FALSE, waffle cells will be scaled to max_value and missing cells filled with an "empty" category.

max_value

numerical giving the value to which waffle cells should be scaled to, if composition = FALSE.

digits

integer indicating the number of decimal places to be used in rounding of the waffle cells.

Value

returns a tibble data frame containing the minimum and maximum extent of each fill level.

See also

Other waffle: round_preserve_sum(), waffle_chart()