util.plot.stack.bar: visualize two categorical variables in stacked bars

Description Usage Arguments Examples

View source: R/utils-plot.R

Description

plot stack bar with proportion percentage for two categorical variables

Usage

1
util.plot.stack.bar(df, x, fill, label.threshold = 0.1, ...)

Arguments

df

data.frame, input data

x

char, variable to plot for statistics

fill

char, variable to partition by color

label.threshold

float, only label percentage greater than threshold

...

extra param for function 'geom_bar'

Examples

1
2
3
mtcars['am'] <- as.factor(mtcars[['am']])
mtcars['gear'] <- as.factor(mtcars[['gear']])
util.plot.stack.bar(mtcars, 'gear', 'am')

6chaoran/lh2util documentation built on Nov. 29, 2020, 1:28 a.m.