Learn R Programming

arules (version 0.1-3)

length: Getting the Number of Elements

Description

S4 methods for length which return the number of elements of objects defined in the package arules.

Usage

## S3 method for class 'rules':
length(x)
## S3 method for class 'itemsets':
length(x)## S3 method for class 'itemMatrix':
length(x)

Arguments

x
an object of class transactions, rules, itemsets,

Value

  • An integer giving the length of x.

Details

For itemMatrix and transactions the length is defined as the number of rows (transactions) in the binary incidence matrix. For sets of associations (rules, itemsets and associations in general) the length is defined as the number of elements in the set (i.e., the number of rules or itemsets). For tidList the length is the number of elements in the object (a transaction ID list belongs to a set of itemsets and contains for each itemset in the set one list element containing several transaction IDs).