Learn R Programming

arules (version 0.1-4)

itemFrequencyPlot: Plotting the Item Frequencies for Objects Based on ``itemMatrix''

Description

Provides the generic function itemFrequencyPlot and the S4 method to create an item frequency bar plot for inspecting the item frequency distribution for objects based on itemMatrix (e.g., transactions, or items in itemsets and rules).

Usage

itemFrequencyPlot(x, ...)
## S3 method for class 'itemMatrix':
itemFrequencyPlot(x, type = "relative", cex.names =  par("cex.axis"), ...)

Arguments

x
the object to be plotted.
...
further arguments are passed on (see barplot from possible arguments).
type
indicates whether item frequencies should be displayed relative of absolute.
cex.names
expansion factor for axis names (bar labels).

Value

  • A numeric vector with the midpoints of the drawn bars; useful for adding to the graph.

See Also

itemMatrix-class

Examples

Run this code
data(Adult_transactions)

# the following example compares the item frequencies
# of people with a rage income (boxes) with the average in the data set

# box plot for young people (first 72 items)
midpoints <- itemFrequencyPlot(
  Adult_transactions[Adult_transactions %in% "income = large", 1:72])

# add the item frequency over all transactions (first 72 items)
lines(midpoints, itemSupport(Adult_transactions[, 1:72]))

Run the code above in your browser using DataLab