Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

seqstatf

State frequencies in the whole sequence data set


Description

Overall frequency of each state of the alphabet in the state sequence object.

Usage

seqstatf(seqdata, weighted = TRUE)

Arguments

seqdata

a sequence object as defined by the seqdef function.

weighted

Logical. Should frequencies account for weights when present in the state sequence object (see seqdef). Default is TRUE. If no weights were assigned during the creation of the sequence object, weighted=TRUE will yield the same result as weighted=FALSE since each sequence is allowed a weight of 1.

Details

The seqstatf function computes the (weighted) count and frequency of each state of the alphabet in seqdata, i.e., the (weighted) sum of the occurrences of a state in seqdata.

Value

A data frame with as many rows as states in the alphabet and two columns, one for the count (Freq) and one for the percentage frequencies (Percent).

Author(s)

Alexis Gabadinho

See Also

seqstatd for the state distribution by time point (position), seqistatd for the state distribution within each sequence.

Examples

## 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)

## States frequencies
seqstatf(actcal.seq)

## Example with weights
data(ex1)
ex1.seq <- seqdef(ex1, 1:13, weights=ex1$weights)

## Unweighted
seqstatf(ex1.seq, weighted=FALSE)

## Weighted
seqstatf(ex1.seq, weighted=TRUE)

TraMineR

Trajectory Miner: a Toolbox for Exploring and Rendering Sequences

v2.2-1
GPL (>= 2)
Authors
Alexis Gabadinho [aut, cph], Matthias Studer [aut, cph] (<https://orcid.org/0000-0002-6269-1412>), Nicolas M"{u}ller [aut], Reto B"{u}rgin [aut], Pierre-Alexandre Fonta [aut], Gilbert Ritschard [aut, cre, cph] (<https://orcid.org/0000-0001-7776-0903>)
Initial release
2020-10-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.