# timeFrequency-methods

##### Count Event Times

`timeFrequency`

counts the number of occurrences of event times, of
the time gaps between the events of a sequence, the minimum or maximum
gap of a sequence, or the span of a sequence.

`timeTable`

cross-tabulates the above statistics for items or
itemsets. For items the sequences are reduced to the events containing
the item.

`firstOrder`

computes a first order model, i.e. a table of counts
of state changes among a collection of timed sequences, where the
elements or the times can be the states.

- Keywords
- models

##### Usage

```
# S4 method for timedsequences
timeFrequency(x, type = c("times", "gaps", "mingap", "maxgap",
"span"))
```# S4 method for timedsequences
timeTable(x, type = c("times","gaps", "mingap", "maxgap", "span"),
itemsets = FALSE)

# S4 method for timedsequences
firstOrder(x, times = FALSE)

##### Arguments

- x
- an object.
- type, itemsets, times
- a string (logical) value specifying the type of count.

##### Value

For `timeFrequency`

returns a vector of counts corresponding with
the set of distinct event times, the set of gaps or spans as indicated
by the names attribute.

For `timeTable`

returns a table of counts with the rownames
corresponding with the reference set of distinct items or itemsets.

For `firstOrder`

a matrix of counts corresponding with the set of
distinct itemsets or event times.

##### Note

Undefined values are not included in the counts, e.g. the `mingap`

of a sequence with one element only. Thus, except for `times`

and
`gaps`

the counts (per item or itemset) always add up to less than
or equal the number of sequences, i.e. `length(x)`

.

##### See Also

Class
```
,
```

```
,
method
```

`size`

,
`times`

,
`itemFrequency`

.

##### Examples

```
## continue example
example("timedsequences-class")
## totals
timeFrequency(z)
timeFrequency(z, "gaps")
timeFrequency(z, "span")
## default items
timeTable(z)
timeTable(z, "gaps")
timeTable(z, "span")
## beware of large data sets
timeTable(z, itemsets = TRUE)
## first order models
firstOrder(z)
firstOrder(z, times = TRUE)
```

*Documentation reproduced from package arulesSequences, version 0.2-19, License: GPL-2*