bargraph: Bargraph Plots

bargraphR Documentation

Bargraph Plots

Description

Create a bargraph of a categorical variable.

Usage

bargraph(x, data, horizontal = FALSE, type = "frequency", col = NULL, ...)

Arguments

x

Formula. An expression of the form ~ x | z where x is the variable we want to make bargraphs for and z is a second, optional, variable we would like to use for faceting.

data

Data frame. The data where the variables can be found.

horizontal

Logical. Use horizontal = TRUE to make a horizontal bargraph.

type

Character. Choose the type of y-axis. Options include "count", "frequency", "proportion" and "percent".

groups

Factor. An additional variable to use for side-by-side bargraphs.

Note

For additional options for creating bargraphs, look at the help file found in the mosaic package or run help(bargraph, package="mosaic") in the console.

Examples

data(cdc)
bargraph(~depressed, data = cdc)
bargraph(~depressed, data = cdc, groups = gender)
bargraph(~depressed | grade, data = cdc, groups = gender)


mobilizingcs/mobilizr documentation built on May 5, 2024, 1:01 a.m.