Learn R Programming

greybox (version 2.0.5)

tableplot: Construct a plot for categorical variable

Description

Function constructs a plot for two categorical variables based on table function

Usage

tableplot(x, y = NULL, labels = TRUE, legend = FALSE, points = TRUE,
  ...)

Arguments

Value

Function does not return anything. It just plots things.

Details

The function produces the plot of the table() function with colour densities corresponding to the respective frequencies of appearance. If the value appears more often than the other (e.g. 0.5 vs 0.15), then it will be darker. By default, the frequency of 0 corresponds to the white colour, the frequency of 1 corresponds to the black. The colours can be changed by defining a different palette via the palette() function. In that case only two first colours are used, where the colour intensity changes from the first one to the second one. The function also adds the number of dots (points) proportional to the number of values in each category to simplify the reading of plots.

See details in the vignette "Marketing analytics with greybox": vignette("maUsingGreybox","greybox")

See Also

plot, table, spread

Examples

Run this code

palette("Tableau")
tableplot(mtcars$am, mtcars$gear)

Run the code above in your browser using DataLab