Changing sequence time granularity by aggregating positions

Description

Changes time granularity of a state sequence object by aggregating successive positions into groups of a user-defined time length.

Usage

1
seqgranularity(seqdata, tspan = 3, method = "last")

Arguments

seqdata

A state sequence object.

tspan

Integer. Number of successive positions grouped together.

method

Character string. Aggregating method. One of "first", "last" (default) or "mostfreq".

Details

Successive positions are aggregated by group of tspan states. The aggregated state is, depending of the method chosen, either the first ("first"), the last ("last") or the most frequent ("mostfreq") state of the tspan long spell. The same applies to the last spell, even when it is shorter than tspan.

Value

The resulting state sequence object.

Warning

This function needs further testing.

Author(s)

Matthias Studer and Gilbert Ritschard

See Also

seqdef

Examples

1
2
3
4
5
6
7
data(mvad)
mvad <- mvad[1:100,]
mvad.seq <- seqdef(mvad[,17:86], xtstep=12)
mvadg.seq <- seqgranularity(mvad.seq, tspan=6, method="first")
par(mfrow=c(2,1))
seqdplot(mvad.seq, withlegend=FALSE, border=NA)
seqdplot(mvadg.seq, withlegend=FALSE)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.