Learn R Programming

TraMineR (version 1.4-1)

seqtab: Frequency table of the sequences

Description

Computes the frequency table of the sequences (count and percent of each sequence).

Usage

seqtab(seqdata, tlim=10, weighted=TRUE, format="SPS")

Arguments

seqdata
a sequence object as defined by the seqdef function.
tlim
if tlim>0, return frequencies only for the 'tlim' most frequent sequences. Default to 10.
weighted
if TRUE, frequencies account for the weights assigned to the state sequence object (see seqdef). Set to FALSE if you want ignore the weights. If no weights were assigned during the creation of the sequen
format
format used for displaying sequences as rownames in the output table. Default is SPS format, which yields shorter and more readable sequence representations. Alternatively, "STS" may be specified.

Value

  • An object of class stslist.freq. This is actually a state sequence object (containing a list of state sequences) with added attributes, among others the freq attribute containing the frequency table. There are print and plot methods for such objects. More sophisticated plots can be produced with the seqplot function.

See Also

seqplot, plot.stslist.freq.

Examples

Run this code
## Creating a sequence object from the actcal data set
data(actcal)
actcal.lab <- c("> 37 hours", "19-36 hours", "1-18 hours", "no work")
actcal.seq <- seqdef(actcal, 13:24, labels=actcal.lab)

## 10 most frequent sequences in the data
seqtab(actcal.seq, tlim=10)

## With tlim=0, we get all distinct sequences in the data set 
## sorted according to their frequency
seqtab(actcal.seq, tlim=0)

## Example with weights
## from biofam data set using weigths
data(ex1)
ex1.seq <-  seqdef(ex1, 1:13, weights=ex1$weights)

## Unweighted frequencies
seqtab(ex1.seq, weighted=FALSE)

## Weighted frequencies
seqtab(ex1.seq, weighted=TRUE)

Run the code above in your browser using DataLab