Mosaic plot

Share:

Description

Provides a mosaic plot to visualize the association between two categorical variables

Usage

1

Arguments

formula

A standard R formula written as y~x, where y is the name of the variable playing the role of y and x is the name of the variable playing the role of x.

data

An optional argument giving the name of the data frame that contains x and y. If not specified, the function will use existing definitions in the parent environment.

color

TRUE or FALSE. If FALSE, plots are presented in greyscale. If TRUE, an intelligent color scheme is chosen to shade the plot.

Details

This function shows a mosaic plot to visualize the conditional distributions of y for each level of x, along with the marginal distribution of y to the right of the plot. The widths of the segmented bar charts are proportional to the frequency of each level of x. These plots are the same that appear using associate.

Author(s)

Adam Petrie

References

Introduction to Regression and Modeling

See Also

associate

Examples

1
2
3
  data(ACCOUNT)
	mosaic(Area.Classification~Purchase,data=ACCOUNT,color=TRUE)
	 

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.