For state sequences, the function gets or sets the (short) labels associated to the states in the alphabet of a state sequence object (the list of all possible states). The get form also applies to event sequences, while the set form does not work with event sequences.
alphabet(seqdata, with.missing=FALSE) alphabet(seqdata) <- value
a state sequence object of class
For state sequences only. Vector of characters of the same length as the vector returned by the
A state sequence object—created with the
seqdef function—stores sequences as a matrix where columns are factors. The levels of the factors include the alphabet plus the codes for missing values and void elements. The alphabet function retrieves or sets the “alphabet” attribute of the state sequence object.
The state names composing the alphabet are preferably short labels, since they are used for printing sequences. Longer labels for describing more precisely each state in legend are stored in the “labels” attribute of the sequence object.
For an event sequence object—created with
seqecreate—the get form of
alphabet works as an alias for
levels. The set form
alphabet <- does not work and should not be used.
alphabet’ a character vector containing the alphabet.
alphabet <-’ the updated state sequence object.
Alexis Gabadinho and Gilbert Ritschard
## Creating a sequence object with the columns 13 to 24 ## in the 'actcal' example data set data(actcal) actcal.seq <- seqdef(actcal,13:24) ## Retrieving the alphabet alphabet(actcal.seq) ## Setting the alphabet alphabet(actcal.seq) <- c("FT", "PT", "LT", "NO") ## Event sequences actcal.eseq <- seqecreate(actcal.seq) alphabet(actcal.eseq)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.