Learn R Programming

tabplot (version 0.11-2)

tableplot: Create a tableplot

Description

A tableplot is a visualisation of (large) multivariate datasets. Each column represents a variable and each row bin is an aggregate of a certain number of records. For numeric variables, a bar chart of the mean values is depicted. For categorical variables, a stacked bar chart is depicted of the proportions of categories. Missing values are taken into account. Also supports large ffdf datasets from the ff package.

Usage

tableplot(dat, colNames = names(dat), sortCol = 1,
    decreasing = TRUE, nBins = 100, from = 0, to = 100,
    filter = NULL, scales = "auto",
    pals = list("Set1", "Set2", "Set3", "Set4"),
    colorNA = "#FF1414", numPals = "Blues",
    bias_brokenX = 0.8, IQR_bias = 5, plot = TRUE, ...)

Arguments

dat
a data.frame, data.table, or an ffdf object (required)
colNames
character vector containing the names of the columns of dat that are visualized in the tablelplot. If omitted, all columns are visualized. All selected columns should be of class: numeric, integer, factor, or logical.
sortCol
columns that are sorted. sortCol is either a vector of column names of a vector of indices of colNames
decreasing
determines whether the columns are sorted decreasingly (TRUE) of increasingly (FALSE). decreasing can be either a single value that applies to all sorted columns, or a vector of the same length as sortCol.
nBins
number of row bins
from
percentage from which the data is shown
to
percentage to which the data is shown
filter
filter condition to subset the observations in dat, either a character or an expression. It is also possible to give the name of a categorical variable: then, a tableplot for each category is generated.
scales
determines the horizontal axes of the numeric variables in colNames, options: "lin", "log", and "auto" for automatic detection. If necessary, scales is recycled.
pals
list of color palettes. Each list item is on of the following:
  • a palette name intablePalettes, optionally with the starting color between brackets.
  • a palette vector
The
colorNA
color for missing values
numPals
name(s) of the palette(s) that is(are) used for numeric variables ("Blues", "Greys", or "Greens"). Recycled if necessary.
bias_brokenX
parameter between 0 en 1 that determines when the x-axis of a numeric variable is broken. If minimum value is at least bias_brokenX times the maximum value, then X axis is broken. To turn off broken x-axes, set bias_brokenX=
IQR_bias
parameter that determines when a logarithmic scale is used when scales is set to "auto". The argument IQR_bias is multiplied by the interquartile range as a test.
plot
boolean, to plot or not to plot a tableplot
...
arguments passed to plot.tabplot

Value

Examples

Run this code
# load diamonds dataset from ggplot2
require(ggplot2)
data(diamonds)

# default tableplot
tableplot(diamonds)

# customized tableplot
tableplot(diamonds, colNames=c("carat", "cut", "color", "clarity", "price"), sortCol="price", from=0, to=5)

# apply filter
tableplot(diamonds, filter="price < 5000 & cut=='Premium'")
tableplot(diamonds, filter="cut")

Run the code above in your browser using DataLab