GG_contingency_table: Plot a contingency table with ggplot2

View source: R/plotting.R

GG_contingency_tableR Documentation

Plot a contingency table with ggplot2

Description

Makes a pretty contingency table with ggplot2 using geom_tile.

Usage

GG_contingency_table(data, var1, var2, margin = NULL)

Arguments

data

(data.frame) The data.

var1

(chr scalar) The name of the first variable (vertical)

var2

(chr scalar) The name of the second variable (horizontal)

margin

(NULL, 1, 2) Which margin to use. Default = NULL.

Examples

GG_contingency_table(mpg, "drv", "cyl")
GG_contingency_table(mpg, "drv", "cyl", margin = 1)
GG_contingency_table(mpg, "drv", "cyl", margin = 2)

Deleetdk/kirkegaard documentation built on April 22, 2024, 5:22 p.m.