Description Usage Arguments Value Note Author(s) See Also Examples
Computes the gaps, the minimum or maximum gap, or the span of sequences.
1 2 |
x |
an object. |
type |
a string value specifying the type of statistic. |
If type = "items"
returns a list of vectors of events times
corresponding with the elements of a sequence.
If type = "gaps"
returns a list of vectors of time differences
between consecutive elements of a sequence.
Otherwise, a vector corresponding with the elements of x
.
Gap statistics are not defined for sequences of size one, i.e. which
contain a single element. NA
is used for undefined values.
FIXME lists are silently reduced to vector if possible.
Christian Buchta
Class
sequences
,
timedsequences
,
method
size
,
itemFrequency
,
timeFrequency
.
1 2 3 4 5 6 7 8 9 10 11 12 |
Loading required package: arules
Loading required package: Matrix
Attaching package: 'arules'
The following objects are masked from 'package:base':
abbreviate, write
tmdsq-> ## use example data
tmdsq-> data(zaki)
tmdsq-> ## coerce
tmdsq-> z <- as(zaki, "timedsequences")
tmdsq-> z
set of 4 timedsequences
tmdsq-> ## get time sequences
tmdsq-> summary(timesets(z))
itemMatrix in sparse format with
4 rows (elements/itemsets/transactions) and
4 columns (items) and a density of 0.625
most frequent items:
10 20 15 25 (Other)
3 3 2 2 0
element (itemset/transaction) length distribution:
sizes
1 2 3 4
1 1 1 1
Min. 1st Qu. Median Mean 3rd Qu. Max.
1.00 1.75 2.50 2.50 3.25 4.00
includes extended item information - examples:
labels eventID
1 10 10
2 15 15
3 20 20
tmdsq-> ## coerce back
tmdsq-> as(z, "transactions")
transactions in sparse format with
10 transactions (rows) and
8 items (columns)
[[1]]
[1] 10 15 20 25
[[2]]
[1] 15 20
[[3]]
[1] 10
[[4]]
[1] 10 20 25
[[1]]
[1] 5 5 5
[[2]]
[1] 5
[[3]]
[1] NA
[[4]]
[1] 10 5
[1] 15 5 0 15
span
size 0 5 15
1 1 0 0
2 0 1 0
3 0 0 1
4 0 0 1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.