Learn R Programming

arules (version 0.2-1)

hmap: Draw a Heat Map for Objects Based on ``itemMatrix''

Description

Provides the generic function hmap and the S4 method to draw a heat map (an image with dendrogram added and reordered rows and columns) for objects based on itemMatrix (e.g., transactions).

Usage

hmap(x, ...)
## S3 method for class 'itemMatrix':
hmap(x, distfun = function(z) dist(z, method = "binary"),
    margins = c(10, 10),
        xlab = "Items (Columns)", ylab = "Elements (Rows)",
	    col = gray(seq(from = 1, to = 0, length = 100)), ...)

Arguments

x
an object of class "itemMatrix".
distfun
distance function; default is Jaccard (binary).
margins
a numeric vector of length 2 containing the margins.
xlab, ylab
x- and y-axis titles.
col
used colors.
...
further arguments passed on to heatmap.

Value

  • Invisibly, a list of components from heatmap.

Details

hmap is an interface to heatmap for binary transactions. In addition to make Jaccard the standard distance measure, also columns for items which do not occur in x are discarded before calculating distances. This can make computing the heat map significantly faster for random samples from a set of transactions.

See Also

itemMatrix-class

Examples

Run this code
data(Adult_transactions)

## choose a sample and produce a heat map 
s <- sample(Adult_transactions, 100)
hmap(s)

Run the code above in your browser using DataLab