hbarChart: Visualize proportions of subgroup samples

Description Usage Arguments Details Value Examples

View source: R/doEDA.R

Description

hbarChart() frees user from repetitive workflows for creating horizontal bar chart in order to visualize subgroup distributions.

Usage

1
hbarChart(.tbl_df, ..., columns, .xVar, .fill)

Arguments

.tbl_df

A data frame

...

fixed columns names supplied from .tbl_df

columns

numeric vector that has a length shorter than the supplied by ...

.xVar

One of the variables from ... besides the .fill variable

.fill

One of the variables from ...

Details

.innerGroup should, as the argument suggests, be a list of variables for grouping. They are the unit groups. On the other hand, .outerGroup is a list of variables shorter than .innerGroup. In turn .outerGroup is at an outer level and .innerGroup is a subset of .outerGroup. All the variables passed into .innerGroup and .outerGroup must be selected by vars() as they are quosures inside the function body. You could modify the labels for y axis using scale_y_continuous() since it is a ggplot object.

Value

A ggplot object

Examples

1
2
3
4
5
6
7
library(dplyr)
library(ggplot2)

hbarChart(invest, gender, age, investment, invest_plan, perc,
columns = 3:4, .xVar = age, .fill = perc) +
facet_wrap(vars(invest_plan)) +
scale_fill_brewer(type = "qual", palette = "Blues")

chuckleong21/doEDA documentation built on Nov. 4, 2019, 8:52 a.m.